parent
73127ae825
commit
f7ceeb3dda
|
@ -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 + '(?=:)'),
|
||||
|
|
Loading…
Reference in New Issue