branch : pmacs2
This commit is contained in:
moculus 2008-10-04 15:03:32 +00:00
parent 084df1740e
commit bc5f6802d8
2 changed files with 2 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import commands import commands
import color, mode, tab import color, method, mode, tab
from lex import Grammar, PatternRule, RegionRule from lex import Grammar, PatternRule, RegionRule
from mode.python import StringGrammar2 from mode.python import StringGrammar2
from tab import StackTabber2 from tab import StackTabber2

View File

@ -9,8 +9,6 @@ class CommentGrammar(Grammar):
PatternRule(r'data', r'(?:[^\*]|\*(?!/))+'), PatternRule(r'data', r'(?:[^\*]|\*(?!/))+'),
] ]
# this might not be complete...
# see http://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_3.html#SEC44
class MacroGrammar(Grammar): class MacroGrammar(Grammar):
rules = [ rules = [
PatternRule(r'spaces', r' +'), PatternRule(r'spaces', r' +'),
@ -48,7 +46,7 @@ class CGrammar(Grammar):
PatternRule(r'builtin', r"(?:NULL|TRUE|FALSE)"), PatternRule(r'builtin', r"(?:NULL|TRUE|FALSE)"),
PatternRule(r'label', r'[a-zA-Z_][a-zA-Z0-9_]*(?=:)'), PatternRule(r'label', r'[a-zA-Z_][a-zA-Z0-9_]*(?=:)'),
RegionRule(r'macro', r'# *(?:assert|cpu|define|elif|else|endif|error|ident|ifdef|ifndef|if|import|include_next|line|machine|pragma|pragma_once|system|unassert|undef|warning)(?!=[a-zA-Z0-9_])', MacroGrammar, 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'\*/'), RegionRule(r'comment', r'/\*', CommentGrammar, r'\*/'),
PatternRule(r'comment', r'//.*$'), PatternRule(r'comment', r'//.*$'),