perl mode improvements/fixes

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-07-30 14:44:28 +00:00
parent b708191ef0
commit daa843abba
2 changed files with 15 additions and 3 deletions

2
BUGS
View File

@ -16,7 +16,7 @@
2008/05/16:
paired delimiters in perl regexes either never worked or are broken.
dammit.
dammit. (FIXED 2008/07/29)
2007/07/15:
sometimes you don't get search-as-you-type (and have to hit C-s again

View File

@ -15,9 +15,9 @@ class PodGrammar(Grammar):
def _make_string_rules(forbidden=None):
if forbidden:
rule = PatternRule(r'scalar', r"\$[^A-Za-z0-9 \\%s](?![A-Za-z0-9_])" % forbidden)
rule = PatternRule(r'scalar', r"\$[^\[\]\(\){}<>A-Za-z0-9 \\%s](?![A-Za-z0-9_])" % forbidden)
else:
rule = ContextPatternRule(r'scalar', r"\$[^A-Za-z0-9 %(delim)s](?![A-Za-z0-9_])", r"\$[^A-Za-z0-9 ](?![A-Za-z0-9_])")
rule = ContextPatternRule(r'scalar', r"\$[^\[\]\(\){}<>A-Za-z0-9 %(delim)s](?![A-Za-z0-9_])", r"\$[^A-Za-z0-9 ](?![A-Za-z0-9_])")
rules = [
PatternRule(r'octal', r'\\[0-7]{3}'),
@ -81,11 +81,23 @@ class PerlGrammar(Grammar):
PatternRule(r'perl_hash', r"%\$*[A-Za-z_](?:[A-Za-z0-9_]|::)*"),
PatternRule(r'deref', r"[@%\$&\*](?={)"),
# match regexes; paired delimiters
RegionRule(r'match', r'm *(?P<delim>\()', StringGrammar, r'\)[a-z]*'),
RegionRule(r'match', r'm *(?P<delim>\[)', StringGrammar, r'\][a-z]*'),
RegionRule(r'match', r'm *(?P<delim>\{)', StringGrammar, r'\}[a-z]*'),
RegionRule(r'match', r'm *(?P<delim>\<)', StringGrammar, r'\>[a-z]*'),
# match regexes
RegionRule(r'match', r'(?:(?<==~)|(?<=!~)|(?<=\()|(?<=split)|(?<=if)|(?<=unless)|(?<=while)|(?<=until)) *(?P<delim>/)', StringGrammar, r'/[a-z]*'),
RegionRule(r'match', r'm *(?P<delim>[^ #a-zA-Z0-9_])', StringGrammar, r'%(delim)s[a-z]*'),
RegionRule(r'match', r'm(?P<delim>#)', StringGrammar, r'#[a-z]*'),
# match regexes; paired delimiters
RegionRule(r'replace', r's *(?P<delim>\()', StringGrammar, r'\)\(', StringGrammar, r'\)[a-z]*'),
RegionRule(r'replace', r's *(?P<delim>\[)', StringGrammar, r'\]\[', StringGrammar, r'\][a-z]*'),
RegionRule(r'replace', r's *(?P<delim>\{)', StringGrammar, r'\}\{', StringGrammar, r'\}[a-z]*'),
RegionRule(r'replace', r's *(?P<delim>\<)', StringGrammar, r'\>\<', StringGrammar, r'\>[a-z]*'),
# replace regexes
RegionRule(r'replace', r's *(?P<delim>[^ a-zA-Z0-9_])', StringGrammar, r'%(delim)s', StringGrammar, r'%(delim)s[a-z]*'),
RegionRule(r'replace', r's(?P<delim>#)', StringGrammar, r'#', StringGrammar, r'#[a-z]*'),