perl support for prototypes and bug fixing

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-08-17 05:47:44 +00:00
parent 452b32b344
commit e4da6ac546
1 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import re, sets, string, sys
import color, commands, default, method, mode2, regex, tab2
from point2 import Point
from lex3 import Grammar, PatternRule, ContextPatternRule, RegionRule, OverridePatternRule
from lex3 import Grammar, PatternRule, ContextPatternRule, RegionRule, OverridePatternRule, PatternGroupRule
from method import Argument, Method
class PodGrammar(Grammar):
@ -54,6 +54,10 @@ class PerlGrammar(Grammar):
RegionRule(r'pod', r'^=[a-zA-Z0-9_]+', PodGrammar, r'^=cut'),
OverridePatternRule(r'comment', r'#@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *$'),
#PatternRule(r'prototype', r'\([\\@$%&*;]+\)'),
PatternGroupRule(r'prototype', r'delimiter', r'\(', r'prototype', r'[\[\]\\@$%&*;]+', r'delimiter', '\)'),
PatternRule(r'comment', r'#.*$'),
RegionRule(r'string', r'"', StringGrammar, r'"'),
RegionRule(r'string', r"'", Grammar, r"'"),
@ -116,7 +120,7 @@ class PerlGrammar(Grammar):
PatternRule(r'class', r"(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*(?=->)"),
# some basic stuff
PatternRule(r'delimiter', r"[,;=\?(){}\[\]]|->|=>|(?<!:):(?!=:)"),
PatternRule(r'delimiter', r"[,;=\?(){}\[\]\(\)]|->|=>|(?<!:):(?!=:)"),
PatternRule(r'operator', r"\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="),
PatternRule(r'operator', r"\+\+|\+|<=>|<>|<<|<=|<|-|>>|>=|>|\*\*|\*|&&|&|\|\||\||/|\^|==|//|~|=~|!~|!=|%|!|\.|x(?![a-zA-Z_])"),
PatternRule(r'noperator', r"(?:xor|or|not|ne|lt|le|gt|ge|eq|cmp|and)(?![a-zA-Z_])"),
@ -203,6 +207,7 @@ class Perl(mode2.Fundamental):
'null': ('default', 'default'),
'delimiter': ('default', 'default'),
'sub': ('cyan', 'default'),
'prototype': ('magenta', 'default'),
'number': ('default', 'default'),
'operator': ('default', 'default'),
'noperator': ('magenta', 'default'),