diff --git a/mode/c.py b/mode/c.py index 4035b68..ee6fff1 100644 --- a/mode/c.py +++ b/mode/c.py @@ -79,9 +79,10 @@ class CGrammar(Grammar): PatternRule("c.operator", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="), PatternRule('c.operator', r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&&|&|\*|\|\||\||/|\^|==|//|~|!=|%"), RegionRule('c.macrocomment', '#if +(?:0|NULL|FALSE)', Grammar, '#endif'), - PatternMatchRule('', r"(')(.)(')", 'c.char.start', 'c.char.data', 'c.char.end'), + PatternMatchRule('', r"(')([^\\])(')", 'c.char.start', 'c.char.data', 'c.char.end'), PatternMatchRule('', r"(')(\\.)(')", 'c.char.start', 'c.char.escaped', 'c.char.end'), PatternMatchRule('', r"(')(\\[0-7]{3})(')", 'c.char.start', 'c.char.octal', 'c.char.end'), + PatternMatchRule('', r"(')(\\x[0-9a-fA-F]{2})(')", 'c.char.start', 'c.char.hex', 'c.char.end'), #PatternRule('c.char', r"'.'|'\\.'|'\\[0-7]{3}'"), PatternMatchRule('x', r'(# *include)( +)(.+)(\n|$)', 'c.macro.start', 'spaces', 'c.header', 'c.macro.end'), @@ -237,6 +238,7 @@ class C(Fundamental): 'c.char.data': hi_green, 'c.char.escaped': hi_magenta, 'c.char.octal': hi_magenta, + 'c.char.hex': hi_magenta, 'c.type': hi_cyan, 'c.include': hi_blue,