From 910d4046ac3a6bd45ccf4f126d4491e43c742097 Mon Sep 17 00:00:00 2001 From: moculus Date: Thu, 26 Mar 2009 21:32:52 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- mode/perl.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mode/perl.py b/mode/perl.py index e03e479..37582b0 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -33,12 +33,17 @@ def _make_string_rules(forbidden): ] return rules -class NoParen(Grammar): rules = [PatternRule(r'data', 'r[^\)]+')] -class NoBrace(Grammar): rules = [PatternRule(r'data', 'r[^\}]+')] -class NoBracket(Grammar): rules = [PatternRule(r'data', 'r[^\]]+')] -class NoAngle(Grammar): rules = [PatternRule(r'data', 'r[^>]+')] -class NoHash(Grammar): rules = [PatternRule(r'data', 'r[^#]+')] -class DataGrammar(Grammar): rules = [PatternRule(r'data', '.+')] +class QuotedWords(Grammar): rules = [ + PatternRule(r'data', r'[a-zA-Z0-9_]+'), + PatternRule(r'eol', r'\n'), + PatternRule(r'spaces', r' +'), +] +class NoParen(Grammar): rules = [PatternRule(r'data', r'[^)]+')] +class NoBrace(Grammar): rules = [PatternRule(r'data', r'[^\}]+')] +class NoBracket(Grammar): rules = [PatternRule(r'data', r'[^\]]+')] +class NoAngle(Grammar): rules = [PatternRule(r'data', r'[^>]+')] +class NoHash(Grammar): rules = [PatternRule(r'data', r'[^#]+')] +class DataGrammar(Grammar): rules = [PatternRule(r'data', r'.+')] class StrictStringGrammar(Grammar): rules = [ @@ -157,7 +162,7 @@ class PerlGrammar(Grammar): RegionRule(r'quoted', r'q[rqx](?P#)', StringGrammar, r'#'), # quote operator: q() and qw() do not interpolate - RegionRule(r'quoted', r'qw? *\(', NoParen, r'\)'), + RegionRule(r'quoted', r'qw? *\(', QuotedWords, r'\)'), RegionRule(r'quoted', r'qw? *{', NoBrace, r'}'), RegionRule(r'quoted', r'qw? *<', NoAngle, r'>'), RegionRule(r'quoted', r'qw? *\[', NoBracket, r'\]'),