From 7709f94ae4ef098bae4cbceaa8da66467709211b Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Mon, 27 Jul 2009 11:19:20 -0400 Subject: [PATCH] fixed annoying perl regex interpolation issue --HG-- branch : pmacs2 --- mode/perl.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mode/perl.py b/mode/perl.py index cd054d4..833f084 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -60,15 +60,11 @@ scalar_rules = [ 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'\$\^(?:' + word1 + '|' + wchr1 + ')'), PatternRule('perl.scalar', r'\$\^O'), 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): @@ -162,6 +158,8 @@ PerlGrammar.rules = [ PatternRule('perl.function', r"\$\$*" + word2 + "(?=-> *\()"), + # special scalar; doesn't interpolate well + PatternRule('perl.scalar', r'\$/'), ] + scalar_rules + [ # match regexes; paired delimiters