Commits

gbrandl  committed 99210df

Makefile lexer fixes by Tim.

  • Participants
  • Parent commits 4ceaaa1
  • Branches trunk

Comments (0)

Files changed (1)

File pygments/lexers/text.py

     Lexer for BSD and GNU make extensions (lenient enough to handle both in
     the same file even).
 
-    *Rewritten in Pygments 1.0.*
+    *Rewritten in Pygments 0.10.*
     """
 
     name = 'Makefile'
     """
     Lexer for simple Makefiles (no preprocessing).
 
-    *New in Pygments 1.0.*
+    *New in Pygments 0.10.*
     """
 
     name = 'Makefile'
 
     tokens = {
         'root': [
+            (r'^(?:[\t ]+.*\n|\n)+', using(BashLexer)),
+            (r'\$\((?:.*\\\n|.*\n)+', using(BashLexer)),
             (r'\s+', Text),
             (r'#.*?\n', Comment),
             (r'(export)(\s+)(?=[a-zA-Z0-9_${}\t -]+\n)',
              bygroups(Keyword, Text), 'export'),
             (r'export\s+', Keyword),
             # assignment
-            (r'([a-zA-Z0-9_${}-]+)(\s*)([!?:+]?=)([ \t]*)',
-             bygroups(Name.Variable, Text, Operator, Text), 'var'),
+            (r'([a-zA-Z0-9_${}.-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n|.*\n)+)',
+             bygroups(Name.Variable, Text, Operator, Text, using(BashLexer))),
             # strings
             (r'"(\\\\|\\"|[^"])*"', String.Double),
             (r"'(\\\\|\\'|[^'])*'", String.Single),
             (r'\n', Text, '#pop'),
             (r'\s+', Text),
         ],
-        'var': [
-            (r'\\\n', String),
-            (r'\\', String),
-            (r'\n', Text, '#pop'),
-            (r'[^\\\n]+', String),
-        ],
         'block-header': [
             (r'[^,\\\n#]+', Number),
             (r',', Punctuation),
     format.  Examples of this format are derived by commands such as
     ``darcs annotate --patch`` and ``darcs send``.
 
-    *New in Pygments 1.0.*
+    *New in Pygments 0.10.*
     """
     name = 'Darcs Patch'
     aliases = ['dpatch']