Skip to content

Commit

Permalink
Fixed a silly bug to do with += handling
Browse files Browse the repository at this point in the history
  • Loading branch information
patmorin committed Feb 5, 2014
1 parent f49fab8 commit 2ee631e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions latex/snarf-python.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def translate_code(line):
# super(Class,self) => super
line = re.sub(r'super\([^)]*\)', 'super', line)

# a += b => a = a + b --- handles +=, -=, *=, and /=
line = re.sub(r'([^\s]+)\s*([+*-/])=\s*(.*)$', r'\1 = \1 \2 \3', line)

# turn assignment operator (=) into \gets
line = re.sub(r'([^-*/<>!=+])=([^=])', r'\1\\gets \2', line)

Expand Down Expand Up @@ -122,9 +125,6 @@ def translate_code(line):
# <blah>.hashCode() => hash_code(<blah>)
# line = re.sub(r'(\w+)\.hashCode()', r'hash_code(\1)', line)

# a += b => a = a + b --- handles +=, -=, *=, and /=
line = re.sub(r'([^\s]+)\s*([+*-/])=\s*(.*)$', r'\1 = \1 \2 \3', line)

# get rid of any remaining colons
line = re.sub(r':', '', line)

Expand Down

0 comments on commit 2ee631e

Please sign in to comment.