From 03105557a69f05118bd128e9914a1de3399bdafe Mon Sep 17 00:00:00 2001 From: moculus Date: Fri, 20 Mar 2009 04:25:20 +0000 Subject: [PATCH] some c improvements --HG-- branch : pmacs2 --- mode/c.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mode/c.py b/mode/c.py index ce83393..281c850 100644 --- a/mode/c.py +++ b/mode/c.py @@ -58,19 +58,18 @@ class CGrammar(Grammar): PatternRule(r'function', r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\()'), PatternRule(r'constant', r"[A-Z_][A-Z0-9_]+"), - #PatternRule(r'builtin', r"(?:NULL|TRUE|FALSE)(?![a-zA-Z0-9_])"), PatternRule(r'label', r'[a-zA-Z_][a-zA-Z0-9_]*(?=:)'), RegionRule(r'error', r'# *error', ErrorGrammar, r'\n$'), RegionRule(r'macro', r'# *(?:assert|cpu|define|elif|else|endif|error|ident|ifdef|ifndef|if|import|include_next|line|machine|pragma_once|pragma|system|unassert|undef|warning)(?!=[a-zA-Z0-9_])', MacroGrammar, r'\n$'), RegionRule(r'comment', r'/\*', CommentGrammar, r'\*/'), PatternRule(r'comment', r'//.*$'), RegionRule(r'string', '"', StringGrammar2, '"'), - #PatternRule(r"unop", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="), - #PatternRule(r'binop', r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"), + + PatternRule(r"float", r"-?[0-9]+\.[0-9]*|-?\.[0-9]+|-?(?:[0-9]|[0-9]+\.[0-9]*|-?\.[0-9]+)[eE][\+-]?[0-9]+"), + PatternRule(r"integer", r"(?:0(?![x0-9])|-?[1-9][0-9]*|0[0-7]+|0[xX][0-9a-fA-F]+)[lL]?"), + PatternRule(r"operator", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="), PatternRule(r'operator', r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"), - PatternRule(r"integer", r"(?:0(?![x0-9])|[1-9][0-9]*|0[0-7]+|0[xX][0-9a-fA-F]+)[lL]?"), - PatternRule(r"float", r"[0-9]+\.[0-9]*|\.[0-9]+|(?:[0-9]|[0-9]+\.[0-9]*|\.[0-9]+)[eE][\+-]?[0-9]+"), RegionRule(r'macrocomment', r'#if +(?:0|NULL|FALSE)', Grammar, r'#endif'), PatternRule(r'char', r"'.'|'\\.'|'\\[0-7]{3}'"), PatternGroupRule(r'includegrp', r'macro.start', r'# *include', r'spaces',