1. Mloc
  2. pygments-main


thatch  committed 832a7ca

Highlight whitespace prior to preproc directives as text, since `\n` counts
as whitespace in this case and was leaking into the preproc match.

  • Participants
  • Parent commits c61c682
  • Branches trunk

Comments (0)

Files changed (1)

File pygments/lexers/compiled.py

View file
  • Ignore whitespace
     tokens = {
         'whitespace': [
-            (r'^\s*#if\s+0', Comment.Preproc, 'if0'),
-            (r'^\s*#', Comment.Preproc, 'macro'),
+            (r'^(\s*)(#if\s+0)', bygroups(Text, Comment.Preproc), 'if0'),
+            (r'^(\s*)(#)', bygroups(Text, Comment.Preproc), 'macro'),
             (r'\n', Text),
             (r'\s+', Text),
             (r'\\\n', Text), # line continuation