diff options
author | Gaurav Jain <gaurav@gauravjain.org> | 2014-04-23 10:10:01 -0400 |
---|---|---|
committer | Gaurav Jain <gaurav@gauravjain.org> | 2014-04-23 10:10:01 -0400 |
commit | 7fba6853c367074bc93f19f25af2673a1d6d4410 (patch) | |
tree | 65c4e3162d73836add7729ea0543a3b3be6a2b33 /pygments | |
parent | 6747ef30d28dbc52edf019e47f6edb7fb773b3db (diff) | |
download | pygments-7fba6853c367074bc93f19f25af2673a1d6d4410.tar.gz |
Reorder regex expressions so that C keywords are matched before a label
Keywords need to be matched before C labels to correctly handle the default keyword in switch/case blocks
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/lexers/compiled.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 82af5426..ecf21b9c 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -56,8 +56,6 @@ class CFamilyLexer(RegexLexer): bygroups(using(this), Comment.Preproc), 'if0'), ('^(' + _ws1 + ')(#)', bygroups(using(this), Comment.Preproc), 'macro'), - (r'^(\s*)([a-zA-Z_][a-zA-Z0-9_]*)(\s*:)(?!:)', - bygroups(Text, Name.Label, Text)), (r'\n', Text), (r'\s+', Text), (r'\\\n', Text), # line continuation @@ -89,6 +87,7 @@ class CFamilyLexer(RegexLexer): r'declspec|finally|int64|try|leave|wchar_t|w64|unaligned|' r'raise|noop|identifier|forceinline|assume)\b', Keyword.Reserved), (r'(true|false|NULL)\b', Name.Builtin), + (r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*:)(?!:)', bygroups(Name.Label, Text)), ('[a-zA-Z_][a-zA-Z0-9_]*', Name), ], 'root': [ |