branch : pmacs2
This commit is contained in:
moculus 2008-10-02 21:48:49 +00:00
parent 41a8a5d9a2
commit db2675aac5
1 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,7 @@ def _make_string_rules(forbidden):
PatternRule(r'escaped', r'\\.'),
PatternRule(r'deref', r"\$+[A-Za-z0-9_](?:[A-Za-z0-9_]|::)*(?:(?:->)?{\$?(?:[a-zA-Z_][a-zA-Z_0-9]*|'(?:\\.|[^'\\])*'|\"(\\.|[^\\\"])*\")}|(?:->)?\[\$?[0-9a-zA-Z_]+\])+"),
PatternRule(r'length', r"\$#[A-Za-z0-9_](?:[A-Za-z0-9_]|::)*"),
rule1,
#rule1,
PatternRule(r'scalar', r"\$\$*[A-Za-z0-9_](?:[A-Za-z0-9_]|::)*"),
PatternRule(r'cast', r"[\$\@\%\&]{.*?}"),
PatternRule(r'array', r"@\$*[A-Za-z_](?:[A-Za-z0-9_]|::)*"),
@ -37,6 +37,9 @@ class StrictStringGrammar(Grammar):
class StringGrammar(Grammar):
rules = _make_string_rules('"')
class MatchGrammar(Grammar):
rules = _make_string_rules('/')
class QuotedGrammar1(Grammar):
rules = _make_string_rules(')')
class QuotedGrammar2(Grammar):
@ -88,6 +91,7 @@ class PerlGrammar(Grammar):
# match regexes
RegionRule(r'match', r'(?:(?<==~)|(?<=!~)|(?<=\()|(?<=split)|(?<=if)|(?<=unless)|(?<=while)|(?<=until)) *(?P<delim>/)', StringGrammar, r'/[a-z]*'),
RegionRule(r'match', r'm *(?P<delim>/)', MatchGrammar, 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]*'),