Corrected bug with += in strings

This commit is contained in:
Anthony Scemama 2015-11-26 16:50:03 +01:00
parent e7f9ec3075
commit 3729312876
1 changed files with 6 additions and 1 deletions

View File

@ -366,7 +366,12 @@ def add_operators(text):
result = []
for line in text:
buffer = line.text
if "+=" in buffer:
ls = buffer.strip()
if ls.startswith('print ') or \
ls.startswith('print*') or \
ls.startswith('write('):
pass
elif "+=" in buffer:
if buffer.lstrip().startswith("if "):
re_incr = re.compile(r"(.*)(\))(\s*)(.*)(\+=)(.*$)",re.S)
line.text = re.sub(re_incr,r'\1\2\4=\4+(\6)', buffer)