From dd784fb48310b448e41ef402241c6dfa476e8b4d Mon Sep 17 00:00:00 2001 From: moculus Date: Fri, 13 Jul 2007 12:26:29 +0000 Subject: [PATCH] sql improvements --HG-- branch : pmacs2 --- mode_console.py | 8 ++------ tab_sql.py | 51 ------------------------------------------------- 2 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 tab_sql.py diff --git a/mode_console.py b/mode_console.py index 0b59e49..3bb2339 100644 --- a/mode_console.py +++ b/mode_console.py @@ -1,16 +1,13 @@ -import code, string, StringIO, sys, traceback -import color, completer, method, mode2 +import color, mode2 from lex2 import Grammar, PatternRule -from point2 import Point class ConsoleGrammar(Grammar): rules = [ PatternRule(name=r'mesg', pattern=r'^[A-Za-z].*$'), PatternRule(name=r'input', pattern=r'^>>>.*$'), - PatternRule(name=r'input2', pattern=r'^-->.*$'), + PatternRule(name=r'input', pattern=r'^-->.*$'), PatternRule(name=r'output', pattern=r'^ .*$'), ] - class Console(mode2.Fundamental): grammar = ConsoleGrammar() def __init__(self, w): @@ -18,7 +15,6 @@ class Console(mode2.Fundamental): self.colors = { 'mesg': color.build('blue', 'default'), 'input': color.build('cyan', 'default'), - 'input2': color.build('cyan', 'default'), 'output': color.build('default', 'default'), } def name(self): diff --git a/tab_sql.py b/tab_sql.py deleted file mode 100644 index 4c8869b..0000000 --- a/tab_sql.py +++ /dev/null @@ -1,51 +0,0 @@ -import tab - -class SQLTabber(tab.TokenStackTabber): - close_tags = {')': '('} - - def error(self, s): - self.mode.window.application.set_error(s) - self.errors = True - - def base_indentation_level(self, y): - return y == 0 - - def stack_append_const(self, c): - if self.tab_stack[-1][0] != c: - self.stack_append((c, self.tab_stack[-1][1] + 4)) - def stack_pop_const(self, c): - if self.tab_stack[-1][0] in c_args: - self.stack_pop() - def stack_pop_all_const(self, *c_args): - while self.tab_stack[-1][0] in c_args: - self.stack_pop() - - def handle_token(self, prev_token, token, next_token, y=None): - buffer = self.mode.window.buffer - name = token.name - s = token.string - - if name == 'delimiter': - if s == '(': - if next_token is None: - self.stack_append((s, self.tab_stack[-1][1] + 4)) - else: - p = buffer.get_offset_point(next_token.start) - self.stack_append((s, p.x)) - elif s == ')': - if self.tab_stack[-1][0] == self.close_tags[s]: - self.stack_pop() - if prev_token is None: - self.line_depth = self.tab_stack[-1][1] - elif self.errors is False: - self.error("tag mismatch, line %d: expected %r, got %r" % - (self.y, self.tab_stack[-1][0], s)) - elif s == ',': - pass - elif s == ';': - pass - elif name == 'string': - if token.start > self.start_offset: - self.stack_append(('string', -1)) - if token.end <= self.end_offset: - self.stack_pop_all_const("string")