From 5dcfd8406cca067765c3f466129578e43fb622d0 Mon Sep 17 00:00:00 2001 From: moculus Date: Thu, 12 Jul 2007 22:14:51 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- tab_javascript.py | 60 ----------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 tab_javascript.py diff --git a/tab_javascript.py b/tab_javascript.py deleted file mode 100644 index 1f5b220..0000000 --- a/tab_javascript.py +++ /dev/null @@ -1,60 +0,0 @@ -import tab - -class JavascriptTabber(tab.TokenStackTabber): - close_tags = {'}': '{', - ')': '(', - ']': '['} - - def error(self, s): - self.mode.window.application.set_error(s) - self.errors = True - - def base_indentation_level(self, y): - if y == 0: - return True - lines = self.mode.window.buffer.lines - if y < len(lines) and lines[y].startswith('function '): - return True - return False - - 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 == "{" or s == "(" or s == "[": - if prev_token is None: - self.stack_pop_all_const("cont") - 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 == "}" or s == ")" or s == "]": - self.stack_pop_all_const("cont") - 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)) - if s == "}": - self.stack_pop_all_const("cont") - else: - pass - elif s == "=" and next_token is None: - self.stack_append_const("cont") - elif s == ";": - self.stack_pop_all_const("cont")