fixed annoying perl regex interpolation issue

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-07-27 11:19:20 -04:00
parent 414c3f4fff
commit 7709f94ae4
1 changed files with 3 additions and 5 deletions

View File

@ -60,15 +60,11 @@ scalar_rules = [
PatternRule('perl.hash', r"\%\$*" + word2), PatternRule('perl.hash', r"\%\$*" + word2),
PatternRule('perl.hash', r'\$' + word2 + '(?= *\{)'), PatternRule('perl.hash', r'\$' + word2 + '(?= *\{)'),
PatternRule('perl.scalar', r'\$[_ab&`\'\+\*\./|,\\";#\%=\-~\^:\?!@\$<>()\[\]](?!' + wchr2 + ')'), PatternRule('perl.scalar', r'\$[_ab&`\'\+\*\.|,\\";#\%=\-~\^:\?!@\$<>()\[\]](?!' + wchr2 + ')'),
PatternRule('perl.scalar', r'\$\d+(?!' + wchr2 +')'), PatternRule('perl.scalar', r'\$\d+(?!' + wchr2 +')'),
PatternRule('perl.scalar', r'\$\^(?:' + word1 + '|' + wchr1 + ')'), PatternRule('perl.scalar', r'\$\^(?:' + word1 + '|' + wchr1 + ')'),
PatternRule('perl.scalar', r'\$\^O'), PatternRule('perl.scalar', r'\$\^O'),
PatternRule('perl.scalar', r'\${\^' + word1 + '}'), PatternRule('perl.scalar', r'\${\^' + word1 + '}'),
PatternRule('perl.scalar', r"\$[\[\]<>ab/'\"_@\?#\$!%^|&*()](?!" + wchr2 + ")"),
PatternRule('perl.scalar', r"\$[0-9]+"),
PatternRule('perl.scalar', r"\$\$*" + word2),
] ]
def _make_string_rules(forbidden): def _make_string_rules(forbidden):
@ -162,6 +158,8 @@ PerlGrammar.rules = [
PatternRule('perl.function', r"\$\$*" + word2 + "(?=-> *\()"), PatternRule('perl.function', r"\$\$*" + word2 + "(?=-> *\()"),
# special scalar; doesn't interpolate well
PatternRule('perl.scalar', r'\$/'),
] + scalar_rules + [ ] + scalar_rules + [
# match regexes; paired delimiters # match regexes; paired delimiters