small bugfix for s{foo} {bar} regexes.
--HG-- branch : pmacs2
This commit is contained in:
parent
d2f4ba2d64
commit
6b5b2eb244
25
mode/perl.py
25
mode/perl.py
|
@ -16,6 +16,12 @@ from tab import StackTabber, StackTabber2
|
|||
from parse import Any, And, Or, Optional, Name, Match, Matchs
|
||||
import term
|
||||
|
||||
class WhitespaceGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule('spaces', ' +'),
|
||||
PatternRule('eol', r'\n'),
|
||||
]
|
||||
|
||||
class PodDataGrammar(Grammar):
|
||||
rules = [PatternRule(r'data', r'[^\n]+\n$')]
|
||||
|
||||
|
@ -150,14 +156,22 @@ class PerlGrammar(Grammar):
|
|||
RegionRule('perl.match', 'm(?P<delim>#)', MatchGrammar2, '#[a-z]*'),
|
||||
|
||||
# match regexes; paired delimiters
|
||||
#RegionRule('perl.replace', r's *(?P<delim>\()', MatchGrammar3,
|
||||
# r'\) *\(', MatchGrammar3, r'\)[a-z]*'),
|
||||
#RegionRule('perl.replace', r's *(?P<delim>\[)', MatchGrammar4,
|
||||
# r'\] *\[', MatchGrammar4, r'\][a-z]*'),
|
||||
#RegionRule('perl.replace', r's *(?P<delim>\{)', MatchGrammar5,
|
||||
# r'\} *\{', MatchGrammar5, r'\}[a-z]*'),
|
||||
#RegionRule('perl.replace', r's *(?P<delim>\<)', MatchGrammar6,
|
||||
# r'\> *\<', MatchGrammar6, r'\>[a-z]*'),
|
||||
RegionRule('perl.replace', r's *(?P<delim>\()', MatchGrammar3,
|
||||
r'\) *\(', MatchGrammar3, r'\)[a-z]*'),
|
||||
r'\)', WhitespaceGrammar, '\(', MatchGrammar3, r'\)[a-z]*'),
|
||||
RegionRule('perl.replace', r's *(?P<delim>\[)', MatchGrammar4,
|
||||
r'\] *\[', MatchGrammar4, r'\][a-z]*'),
|
||||
r'\]', WhitespaceGrammar, '\[', MatchGrammar4, r'\][a-z]*'),
|
||||
RegionRule('perl.replace', r's *(?P<delim>\{)', MatchGrammar5,
|
||||
r'\} *\{', MatchGrammar5, r'\}[a-z]*'),
|
||||
r'\}', WhitespaceGrammar, '\{', MatchGrammar5, r'\}[a-z]*'),
|
||||
RegionRule('perl.replace', r's *(?P<delim>\<)', MatchGrammar6,
|
||||
r'\> *\<', MatchGrammar6, r'\>[a-z]*'),
|
||||
r'\>', WhitespaceGrammar, '\<', MatchGrammar6, r'\>[a-z]*'),
|
||||
|
||||
# replace regexes
|
||||
RegionRule('perl.replace', 's *(?P<delim>/)', MatchGrammar1,
|
||||
|
@ -208,6 +222,8 @@ class PerlGrammar(Grammar):
|
|||
PatternRule('perl.function', word2 + r"(?= *\()"),
|
||||
PatternRule('perl.class', word2 + "(?=->)"),
|
||||
|
||||
PatternRule('perl.glob', r'(?:(?<=[^a-zA-Z0-9_])|(?<=^)) *\*[^ ]+'),
|
||||
|
||||
# some basic stuff
|
||||
PatternRule('delimiter', r"::|->|=>|(?<!:):(?!=:)|[,;=\?(){}\[\]\(\)]"),
|
||||
PatternRule('perl.noperator', "-[rwxoRWXOezsfdlpSbctugkTBMAC](?!" +
|
||||
|
@ -768,6 +784,7 @@ class Perl(Fundamental):
|
|||
# replace regex
|
||||
'replace.start': ('cyan', 'default', 'bold'),
|
||||
'replace.middle0': ('cyan', 'default', 'bold'),
|
||||
'replace.middle1': ('cyan', 'default', 'bold'),
|
||||
'replace.end': ('cyan', 'default', 'bold'),
|
||||
'replace.null': ('cyan', 'default', 'bold'),
|
||||
'replace.escaped': ('magenta', 'default', 'bold'),
|
||||
|
|
Loading…
Reference in New Issue