add support for tabs and $/ where possible

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-04-19 22:38:28 -04:00
parent 75bc5f1092
commit 479e64d1e0
1 changed files with 5 additions and 2 deletions

View File

@ -26,7 +26,7 @@ word1 = wchr1 + wchr2 + '*'
word2 = '(?:' + word1 + "(?:'|::))*" + word1
pname = '[.a-zA-Z0-9_]+'
spaces = PatternRule('spaces', ' +')
spaces = PatternRule('spaces', '[\t ]+')
eol = PatternRule('eol', r'\n')
length = PatternRule('perl.length', r"\$#" + word2)
@ -86,6 +86,9 @@ def _make_string_rules(forbidden):
else:
rules.insert(0, PatternRule('data', "\\$(?=" + forbidden + ')'))
if forbidden != '/':
rules.append(PatternRule('perl.scalar', r'\$/'))
if forbidden == ')':
return rules + [PatternRule('data', r"[^$\%@\(\)]+")]
elif forbidden == '}':
@ -168,7 +171,7 @@ PerlGrammar.rules = [
PatternRule('perl.function', r"\$\$*" + word2 + "(?=-> *\()"),
# special scalar; doesn't interpolate well
#PatternRule('perl.scalar', r'\$/'),
PatternRule('perl.scalar', r'\$/'),
] + scalar_rules + [
# match regexes; paired delimiters