Mercurial > js-scanner
diff jsscan.py @ 4:30c1f55eff96
fixed greedy regexp bug
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Thu, 22 Apr 2010 17:31:32 -0700 |
parents | ce894f57b30c |
children | 815520476fbb |
line wrap: on
line diff
--- a/jsscan.py Thu Apr 22 13:38:20 2010 -0700 +++ b/jsscan.py Thu Apr 22 17:31:32 2010 -0700 @@ -3,9 +3,9 @@ class Tokenizer(object): TOKENS = dict( whitespace=(r'\s+', re.MULTILINE), - string=(r'(".*(?<!\\)")' + string=(r'(".*?(?<!\\)")' r'|' - r"('.*(?<!\\)')"), + r"('.*?(?<!\\)')"), c_comment=(r'\/\*.*\*\/', re.MULTILINE | re.DOTALL), cpp_comment=r'\/\/.*', name=r'[A-Za-z$_][\w]*',