perl mode tag matching

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-06-18 19:58:23 +00:00
parent 95c7facf83
commit fcbdb853f2
3 changed files with 10 additions and 13 deletions

View File

@ -335,7 +335,8 @@ class PerlGrammar(Grammar):
# some basic stuff # some basic stuff
PatternRule( PatternRule(
name=r'delimiter', name=r'delimiter',
pattern=r",|;|->|=>|=|\?|(?<!:):(?!=:)", #pattern=r",|;|->|=>|=|\?|(?<!:):(?!=:)",
pattern=r",|;|->|=>|=|\?|\(|\)|{|}|\[|\](?<!:):(?!=:)",
), ),
PatternRule( PatternRule(
name=r'operator', name=r'operator',

View File

@ -136,15 +136,15 @@ class Fundamental(Handler):
self.add_bindings('cmd-help-buffer', ('M-h',)) self.add_bindings('cmd-help-buffer', ('M-h',))
self.add_bindings('set-mode', ('C-x m',)) self.add_bindings('set-mode', ('C-x m',))
self.add_bindings('cancel', ('C-]',)) self.add_bindings('cancel', ('C-]',))
#self.add_bindings('close-paren', (')',)) self.add_bindings('close-paren', (')',))
#self.add_bindings('close-brace', ('}',)) self.add_bindings('close-brace', ('}',))
#self.add_bindings('close-bracket', (']',)) self.add_bindings('close-bracket', (']',))
# create all the insert actions for the character ranges we like # create all the insert actions for the character ranges we like
for c in string.letters + string.digits + string.punctuation: for c in string.letters + string.digits + string.punctuation:
## closing tags are handled differently # closing tags are handled differently
#if c == ')' or c == ']' or c == '}': if c == ')' or c == ']' or c == '}':
# continue continue
self.add_binding('insert-string-%s' % c, c) self.add_binding('insert-string-%s' % c, c)
# initialize some stuff # initialize some stuff

View File

@ -6,7 +6,7 @@ class Perl(mode2.Fundamental):
def __init__(self, w): def __init__(self, w):
mode2.Fundamental.__init__(self, w) mode2.Fundamental.__init__(self, w)
#self.tag_matching = True self.tag_matching = True
self.grammar = lex2_perl.PerlGrammar() self.grammar = lex2_perl.PerlGrammar()
self.lexer = lex2.Lexer(self.name(), self.grammar) self.lexer = lex2.Lexer(self.name(), self.grammar)
@ -20,10 +20,6 @@ class Perl(mode2.Fundamental):
self.add_action_and_bindings(PerlWhichFunction(), ('C-c w',)) self.add_action_and_bindings(PerlWhichFunction(), ('C-c w',))
self.add_action_and_bindings(PerlListFunctions(), ('C-c W',)) self.add_action_and_bindings(PerlListFunctions(), ('C-c W',))
#self.add_bindings('close-paren', (')',))
#self.add_bindings('close-brace', ('}',))
#self.add_bindings('close-bracket', (']',))
self.default_color = color.build('default', 'default') self.default_color = color.build('default', 'default')
self.colors = { self.colors = {
@ -390,7 +386,7 @@ class PerlHashCleanup(method.Method):
start_p = Point(0, start) start_p = Point(0, start)
end_p = Point(0, end + 1) end_p = Point(0, end + 1)
window.kill(start_p, end_p) window.kill(start_p, end_p)
window.insert(start_p, data) window.insert_string(start_p, data)
class PerlHashCleanup2(method.Method): class PerlHashCleanup2(method.Method):
'''Correctly align assignment blocks and literal hashes''' '''Correctly align assignment blocks and literal hashes'''