improved glob support etc

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-07-17 15:02:03 -04:00
parent 1e9841055e
commit 0bbd3f52e3
1 changed files with 6 additions and 3 deletions

View File

@ -42,7 +42,7 @@ wchr2 = '[a-zA-Z0-9_]'
wchr3 = '[-a-zA-Z0-9_]' wchr3 = '[-a-zA-Z0-9_]'
hword = wchr3 + '+' hword = wchr3 + '+'
word1 = wchr1 + wchr2 + '*' word1 = wchr1 + wchr2 + '*'
word2 = '(?:' + word1 + '::)*' + word1 word2 = '(?:' + word1 + "(?:'|::))*" + word1
pname = '[.a-zA-Z0-9_]+' pname = '[.a-zA-Z0-9_]+'
def _make_string_rules(forbidden): def _make_string_rules(forbidden):
@ -149,7 +149,7 @@ class PerlGrammar(Grammar):
MatchGrammar6, r'\>[a-z]*'), MatchGrammar6, r'\>[a-z]*'),
# match regexes # match regexes
RegionRule('perl.match', r'(?:(?<==~)|(?<=!~)|(?<=\()|(?<=split)|(?<=if)|(?<=unless)|(?<=while)|(?<=until)|(?<=\|\|)) *(?P<delim>/)', MatchGrammar1, '/[a-z]*'), RegionRule('perl.match', r'(?:(?<==~)|(?<=!~)|(?<=\()|(?<=split)|(?<=if)|(?<=unless)|(?<=while)|(?<=until)|(?<=\|\|)|(?<=&&)|(?<==)) *(?P<delim>/)', MatchGrammar1, '/[a-z]*'),
RegionRule('perl.match', 'm *(?P<delim>/)', MatchGrammar1, '/[a-z]*'), RegionRule('perl.match', 'm *(?P<delim>/)', MatchGrammar1, '/[a-z]*'),
RegionRule('perl.match', 'm *(?P<delim>[^ #a-zA-Z0-9_])', RegionRule('perl.match', 'm *(?P<delim>[^ #a-zA-Z0-9_])',
StringGrammar, '%(delim)s[a-z]*'), StringGrammar, '%(delim)s[a-z]*'),
@ -222,7 +222,7 @@ class PerlGrammar(Grammar):
PatternRule('perl.function', word2 + r"(?= *\()"), PatternRule('perl.function', word2 + r"(?= *\()"),
PatternRule('perl.class', word2 + "(?=->)"), PatternRule('perl.class', word2 + "(?=->)"),
PatternRule('perl.glob', r'(?:(?<=[^a-zA-Z0-9_])|(?<=^)) *\*[^ ]+'), PatternRule('perl.glob', r'(?:(?<=[^a-zA-Z0-9_])|(?<=^)) *\*' + word2),
# some basic stuff # some basic stuff
PatternRule('delimiter', r"::|->|=>|(?<!:):(?!=:)|[,;=\?(){}\[\]\(\)]"), PatternRule('delimiter', r"::|->|=>|(?<!:):(?!=:)|[,;=\?(){}\[\]\(\)]"),
@ -801,6 +801,9 @@ class Perl(Fundamental):
'translate.middle0': ('magenta', 'default', 'bold'), 'translate.middle0': ('magenta', 'default', 'bold'),
'translate.end': ('magenta', 'default', 'bold'), 'translate.end': ('magenta', 'default', 'bold'),
'translate.null': ('magenta', 'default', 'bold'), 'translate.null': ('magenta', 'default', 'bold'),
# xyz
'perl.glob': ('magenta', 'default', 'bold'),
} }
config = {} config = {}
lconfig = {'perl.libs': []} lconfig = {'perl.libs': []}