tools: fix js2c macro expansion bug
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 24 Jul 2013 16:13:25 +0000 (18:13 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Wed, 24 Jul 2013 19:49:34 +0000 (21:49 +0200)
If the same macro was used twice in close proximity, the second one
didn't get expanded.

tools/js2c.py

index 772a0f5..bbbccb2 100755 (executable)
@@ -150,9 +150,10 @@ def ExpandMacros(lines, macros):
       result = macro.expand(mapping)
       # Replace the occurrence of the macro with the expansion
       lines = lines[:start] + result + lines[end:]
-      start = lines.find(name + '(', end)
+      start = lines.find(name + '(', start)
   return lines
 
+
 class TextMacro:
   def __init__(self, args, body):
     self.args = args