c-mode rox

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-10-02 20:06:10 +00:00
parent de564a4077
commit 05d0f86c93
1 changed files with 12 additions and 11 deletions

View File

@ -74,14 +74,16 @@ class CGrammar(Grammar):
] ]
class CTabber2(tab.StackTabber2): class CTabber2(tab.StackTabber2):
open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}} open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}}
close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}} close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}}
control_tokens = {'keyword': {'if': 1, 'else': 1, 'while': 1, 'do': 1, 'for': 1}} control_tokens = {'keyword': {'if': 1, 'else': 1, 'while': 1, 'do': 1, 'for': 1}}
end_at_eof = False end_at_eof = False
end_at_tokens = {'delimiter': {';': 1}} end_at_tokens = {'delimiter': {';': 1}}
nocontinue_tokens = {'delimiter': {';': 1}} nocontinue_tokens = {'delimiter': {';': 1}}
start_free_tokens = {'string.start': 'string.end'} start_free_tokens = {'string.start': 'string.end'}
end_free_tokens = {'string.end': 'string.start'} end_free_tokens = {'string.end': 'string.start'}
start_macro_tokens = {'macro.start': 'macro.end'}
end_macro_tokens = {'macro.end': 'macro.start'}
def is_base(self, y): def is_base(self, y):
if y == 0: if y == 0:
return True return True
@ -89,8 +91,8 @@ class CTabber2(tab.StackTabber2):
# this assumes that people aren't gonna use these macros inside of # this assumes that people aren't gonna use these macros inside of
# blocks, which is probably ok. # blocks, which is probably ok.
t0 = tokens[0] t = tokens[0]
if t0.fqname() == 'macro.start' and t0.string in ('#define', '#include'): if t.fqname() == 'macro.start' and t.string in ('#define', '#include'):
return True return True
# detecting function declarations is annoying; this assumes that people # detecting function declarations is annoying; this assumes that people
@ -110,7 +112,6 @@ class CTabber2(tab.StackTabber2):
decl = False decl = False
break break
return decl return decl
def _is_indent(self, t): def _is_indent(self, t):
return t.name == 'spaces' return t.name == 'spaces'
def _is_ignored(self, t): def _is_ignored(self, t):