diff --git a/mode/c.py b/mode/c.py index 8bcb732..a13745d 100644 --- a/mode/c.py +++ b/mode/c.py @@ -37,6 +37,13 @@ class MacroGrammar(Grammar): class CGrammar(Grammar): rules = [ PatternRule('spaces', r' +'), + + PatternMatchRule('x', r'(\()( *)(' + word + r')(\**)( *)(\))( *)(?=[a-zA-Z0-9_\(])', + 'delimiter', 'spaces', 'type', 'operator', 'spaces', 'delimiter', + 'spaces'), + #PatternMatchRule('x', r'(\()(' + word + r')(\))', + # 'delimiter', 'type', 'delimiter'), + PatternRule(r"delimiter", r"\.|\(|\)|\[|\]|{|}|@|,|:|`|;|=(?!=)|\?|->"), PatternRule('eol', r"\n$"), PatternMatchRule('x', r'(struct|enum|union)( +)(' + word + ')', @@ -56,6 +63,7 @@ class CGrammar(Grammar): PatternMatchRule('x', '(' + word + ')(\*+)( +)(' + word + ')', 'type', 'binop', 'spaces', 'identifier'), + PatternRule('function', word + r'(?= *\()'), PatternRule('constant', "[A-Z_][A-Z0-9_]+(?!" + chr2 + ")"), PatternRule('label', word + '(?=:)'),