diff --git a/mode/perl.py b/mode/perl.py index b95615a..f966976 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -31,6 +31,10 @@ def _make_string_rules(forbidden=None): ] return rules +class StrictStringGrammar(Grammar): + rules = [ + PatternRule(r'escaped', r"\\'"), + ] class StringGrammar(Grammar): rules = _make_string_rules() @@ -60,7 +64,7 @@ class PerlGrammar(Grammar): PatternRule(r'comment', r'#.*$'), RegionRule(r'perl_string', r'"', StringGrammar, r'"'), - RegionRule(r'perl_string', r"'", Grammar, r"'"), + RegionRule(r'perl_string', r"'", StrictStringGrammar, r"'"), RegionRule(r'evalstring', r"`", StringGrammar, r"`"), PatternRule(r'number', r'0?\.[0-9]+|[0-9]+(?:\.[0-9]+)?'), PatternRule(r'perl_keyword', r"(?)(?:STDIN|STDERR|STDOUT|continue|do|else|elsif|eval|foreach|for|if|last|my|next|our|package|require|return|sub|undef|unless|until|use|while)(?![a-zA-Z0-9_])"),