From 2078918a3cfe6ea6a0491ef73dff8d9428bbdf18 Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Thu, 27 Aug 2009 11:27:09 -0400 Subject: [PATCH] preparation for CTabber fix --HG-- branch : pmacs2 --- mode/c.py | 6 +++++- tab.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mode/c.py b/mode/c.py index 1f52519..24c7854 100644 --- a/mode/c.py +++ b/mode/c.py @@ -95,7 +95,11 @@ MacroGrammar.rules.extend(CGrammar.rules) class CTabber2(tab.StackTabber2): open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}} close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}} - control_tokens = {'c.builtin': {'if': 1, 'else': 1, 'while': 1, 'do': 1, 'for': 1}} + # NOTE: we actually need at least two kinds of control tokens: + # an if/else class, and a do/for/while class. this is so we can get + # indenting support for else working correctly. + 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 e149f05..56dd758 100644 --- a/tab.py +++ b/tab.py @@ -473,4 +473,4 @@ class StackTabber2(Tabber): if i == start: self._save_curr_level() self._pop_while('continue'); - self._append('control', name, self._get_next_level(), y) + self._append_unless('control', name, self._get_next_level(), y)