Commits

Anonymous committed f379937

Improve parsing of double- and single-quoted strings

  • Participants
  • Parent commits 0ac054e

Comments (0)

Files changed (1)

File pygments/lexers/math.py

             (r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation),
             (r'=|:|;', Punctuation),
 
+            (r'"[^"]*"', String),
+
             # quote can be transpose, instead of string:
             # (not great, but handles common cases...)
             (r'(?<=[\w\)\]])\'', Operator),
-            
             (r'(?<![\w\)\]])\'', String, 'string'),
-            (r'"', String, 'string'),
+
             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
             (r'.', Text),
         ],
         'string': [
-            (r'[^\']*\'', String, '#pop'),
-            (r'[^"]*"', String, '#pop'),
+            (r"[^']*'", String, '#pop'),
         ],
         'deffunc': [
             (r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',