branch : pmacs2
This commit is contained in:
moculus 2007-08-05 14:25:49 +00:00
parent 435bd37405
commit 57056968da
3 changed files with 10 additions and 7 deletions

View File

@ -145,6 +145,7 @@ class Application(object):
'.rst': 'rst',
'.java': 'java',
'.el': 'elisp',
'.scm': 'scheme',
}
self.mode_detection = {
'python': 'python',

View File

@ -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'),

View File

@ -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