summaryrefslogtreecommitdiff
path: root/pygments/lexers/compiled.py
diff options
context:
space:
mode:
authorGaurav Jain <gaurav@gauravjain.org>2014-04-23 10:10:01 -0400
committerGaurav Jain <gaurav@gauravjain.org>2014-04-23 10:10:01 -0400
commit7fba6853c367074bc93f19f25af2673a1d6d4410 (patch)
tree65c4e3162d73836add7729ea0543a3b3be6a2b33 /pygments/lexers/compiled.py
parent6747ef30d28dbc52edf019e47f6edb7fb773b3db (diff)
downloadpygments-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/lexers/compiled.py')
-rw-r--r--pygments/lexers/compiled.py3
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': [