From 57056968da1dec9132e391da12ddb5839e9be443 Mon Sep 17 00:00:00 2001 From: moculus Date: Sun, 5 Aug 2007 14:25:49 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- application.py | 1 + mode/scheme.py | 14 +++++++++----- tab2.py | 2 -- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/application.py b/application.py index 6ff33ce..c0813b6 100755 --- a/application.py +++ b/application.py @@ -145,6 +145,7 @@ class Application(object): '.rst': 'rst', '.java': 'java', '.el': 'elisp', + '.scm': 'scheme', } self.mode_detection = { 'python': 'python', diff --git a/mode/scheme.py b/mode/scheme.py index a31e638..3cece60 100644 --- a/mode/scheme.py +++ b/mode/scheme.py @@ -12,13 +12,13 @@ class StringGrammar(Grammar): class SchemeGrammar(Grammar): rules = [ PatternRule(r'comment', r';.*$'), - PatternRule(r'delimiter', r'\(|\)'), + PatternRule(r'delimiter', r'[()]'), RegionRule(r'string', r'"', StringGrammar, r'"'), PatternRule(r'spaces', r' +'), PatternRule(r'eol', r'\n'), PatternRule(r'abbrev', r"'|`|,\@|,"), - PatternRule(r'keyword', r'define-syntax|define-macro|syntax-rules'), + PatternRule(r'keyword', r'define-syntax|define-macro|syntax-rules|let-syntax|letrec-syntax'), PatternRule(r'keyword', r'quote|lambda|if|set\!|begin|cond|and|or|case|let\*|letrec|let|do|delay|quasiquote|else|=>|define|unquote-splicing|unquote|loop'), # builtin predicates, mutators, and general procedures @@ -36,15 +36,19 @@ class SchemeGrammar(Grammar): ] class SchemeTabber(tab2.StackTabber): - pass + def _handle_open_token(self, currlvl, y, i): + level = self.get_curr_level() + 4 + token = self.get_token(y, i) + self._append(token.string, level) + return currlvl class Scheme(mode2.Fundamental): tabbercls = SchemeTabber grammar = SchemeGrammar opentokens = ('delimiter',) - opentags = {'(': ')',}, + opentags = {'(': ')'} closetokens = ('delimiter',) - closetags = {')': '(',}, + closetags = {')': '('} colors = { 'comment': ('red', 'default'), diff --git a/tab2.py b/tab2.py index 63a707b..dbaf384 100644 --- a/tab2.py +++ b/tab2.py @@ -169,8 +169,6 @@ class StackTabber(Tabber): self._pop() if self.is_leftmost_token(y, i): currlvl = self.get_curr_level() - #else: - # raise Exception, "hmmmm: %r" % self.get_next_left_token(y, i) else: raise Exception, "mismatched closing tag %r vs %r" % (s2, s1) return currlvl