support better tag matching (esp. in scala)

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-10-25 10:42:52 -04:00
parent f93c8bed23
commit bccd1142c0
2 changed files with 7 additions and 5 deletions

View File

@ -989,7 +989,7 @@ class CloseParen(Method):
while y >= 0:
while i >= 0 and i < len(tokens[y]):
token = tokens[y][i]
n = token.name
n = token.fqname()
s = token.string
if n in w.mode.closetokens and s in w.mode.closetags:
tag_stack.append(s)

View File

@ -85,8 +85,10 @@ class ScalaGrammar(Grammar):
class ScalaTabber(StackTabber2):
#open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}}
#close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}}
open_tokens = {'delimiter': {'{': '}', '(': ')'}}
close_tokens = {'delimiter': {'}': '{', ')': '('}}
open_tokens = {'delimiter': {'{': '}', '(': ')'},
'sub.start': {'[': ']'}}
close_tokens = {'delimiter': {'}': '{', ')': '('},
'sub.end': {']': '['}}
control_tokens = {'scala.reserved': set(('if', 'else', 'while', 'do', 'for'))}
end_at_eof = True
start_free_tokens = {'string.start': 'string.end'}
@ -199,9 +201,9 @@ class Scala(Fundamental):
grammar = ScalaGrammar
commentc = '//'
actions = [ScalaStart, ScalaDocBrowse, ScalaDocLookup]
opentokens = ('delimiter',)
opentokens = ('delimiter', 'sub.start')
opentags = {'(': ')', '[': ']', '{': '}'}
closetokens = ('delimiter',)
closetokens = ('delimiter', 'sub.end')
closetags = {')': '(', ']': '[', '}': '{'}
config = {
'scala.api': 'http://www.scala-lang.org/api/current/allclasses.html',