From d2f4ba2d64396f0b3d10598ae8169b184a07caef Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Tue, 23 Jun 2009 14:52:57 -0400 Subject: [PATCH] fixed mode.c indenting bug --HG-- branch : pmacs2 --- mode/c.py | 2 +- tab.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/mode/c.py b/mode/c.py index 62c6127..f733f2d 100644 --- a/mode/c.py +++ b/mode/c.py @@ -92,7 +92,7 @@ MacroGrammar.rules.extend(CGrammar.rules) class CTabber2(tab.StackTabber2): open_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_tokens = {'delimiter': {';': 1}} nocontinue_tokens = {'delimiter': {';': 1, ',': 1}} diff --git a/tab.py b/tab.py index f93e81f..ad3eeb8 100644 --- a/tab.py +++ b/tab.py @@ -354,10 +354,8 @@ class StackTabber2(Tabber): self.record[y] = tuple(self.stack) def _is_indent(self, t): - #return t.name == 'spaces' return t.name in self.is_indent_tokens def _is_ignored(self, t): - #return t.name in ('spaces', 'eol', 'comment') return t.name in self.is_ignored_tokens def _is_close_token(self, t): @@ -461,4 +459,4 @@ class StackTabber2(Tabber): # handle control keywords if i == start: self._save_curr_level() - self._append_unless('control', name, self._get_next_level(), y) + self._append('control', name, self._get_next_level(), y)