fixed mode.c indenting bug

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-06-23 14:52:57 -04:00
parent e0fd436877
commit d2f4ba2d64
2 changed files with 2 additions and 4 deletions

View File

@ -92,7 +92,7 @@ MacroGrammar.rules.extend(CGrammar.rules)
class CTabber2(tab.StackTabber2): class CTabber2(tab.StackTabber2):
open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}} open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}}
close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}} close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}}
control_tokens = {'c.keyword': {'if': 1, 'else': 1, 'while': 1, 'do': 1, 'for': 1}} control_tokens = {'c.builtin': {'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, ',': 1}} nocontinue_tokens = {'delimiter': {';': 1, ',': 1}}

4
tab.py
View File

@ -354,10 +354,8 @@ class StackTabber2(Tabber):
self.record[y] = tuple(self.stack) self.record[y] = tuple(self.stack)
def _is_indent(self, t): def _is_indent(self, t):
#return t.name == 'spaces'
return t.name in self.is_indent_tokens return t.name in self.is_indent_tokens
def _is_ignored(self, t): def _is_ignored(self, t):
#return t.name in ('spaces', 'eol', 'comment')
return t.name in self.is_ignored_tokens return t.name in self.is_ignored_tokens
def _is_close_token(self, t): def _is_close_token(self, t):
@ -461,4 +459,4 @@ class StackTabber2(Tabber):
# handle control keywords # handle control keywords
if i == start: if i == start:
self._save_curr_level() self._save_curr_level()
self._append_unless('control', name, self._get_next_level(), y) self._append('control', name, self._get_next_level(), y)