summaryrefslogtreecommitdiff
path: root/pygments/lexers/templates.py
diff options
context:
space:
mode:
authorGaurav Jain <gaurav@gauravjain.org>2014-05-14 22:41:17 -0400
committerGaurav Jain <gaurav@gauravjain.org>2014-05-14 22:41:17 -0400
commitc526e39da6e14d4e557f854aceaaff86c22530a8 (patch)
treebf866e10c8bb03796256b70e1947060168624a55 /pygments/lexers/templates.py
parent745f1e190950d2510aecc33de9f1727e24ddddf0 (diff)
downloadpygments-c526e39da6e14d4e557f854aceaaff86c22530a8.tar.gz
Replace all occurences of a-zA-Z0-9_ with \w
Diffstat (limited to 'pygments/lexers/templates.py')
-rw-r--r--pygments/lexers/templates.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py
index 6655cd60..46dac2a5 100644
--- a/pygments/lexers/templates.py
+++ b/pygments/lexers/templates.py
@@ -364,7 +364,7 @@ class DjangoLexer(RegexLexer):
r'with(?:(?:out)?\s*context)?|scoped|ignore\s+missing)\b',
Keyword),
(r'(loop|block|super|forloop)\b', Name.Builtin),
- (r'[a-zA-Z][a-zA-Z0-9_-]*', Name.Variable),
+ (r'[a-zA-Z][\w-]*', Name.Variable),
(r'\.\w+', Name.Variable),
(r':?"(\\\\|\\"|[^"])*"', String.Double),
(r":?'(\\\\|\\'|[^'])*'", String.Single),
@@ -745,7 +745,7 @@ class CheetahLexer(RegexLexer):
(bygroups(Comment.Preproc, using(CheetahPythonLexer),
Comment.Preproc))),
# TODO support other Python syntax like $foo['bar']
- (r'(\$)([a-zA-Z_][a-zA-Z0-9_\.]*\w)',
+ (r'(\$)([a-zA-Z_][\w\.]*\w)',
bygroups(Comment.Preproc, using(CheetahPythonLexer))),
(r'(\$\{!?)(.*?)(\})(?s)',
bygroups(Comment.Preproc, using(CheetahPythonLexer),
@@ -843,7 +843,7 @@ class GenshiTextLexer(RegexLexer):
'variable': [
(r'(?<!\$)(\$\{)(.+?)(\})',
bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
- (r'(?<!\$)(\$)([a-zA-Z_][a-zA-Z0-9_\.]*)',
+ (r'(?<!\$)(\$)([a-zA-Z_][\w\.]*)',
Name.Variable),
]
}
@@ -871,7 +871,7 @@ class GenshiMarkupLexer(RegexLexer):
],
'pytag': [
(r'\s+', Text),
- (r'[a-zA-Z0-9_:-]+\s*=', Name.Attribute, 'pyattr'),
+ (r'[\w:-]+\s*=', Name.Attribute, 'pyattr'),
(r'/?\s*>', Name.Tag, '#pop'),
],
'pyattr': [
@@ -881,8 +881,8 @@ class GenshiMarkupLexer(RegexLexer):
],
'tag': [
(r'\s+', Text),
- (r'py:[a-zA-Z0-9_-]+\s*=', Name.Attribute, 'pyattr'),
- (r'[a-zA-Z0-9_:-]+\s*=', Name.Attribute, 'attr'),
+ (r'py:[\w-]+\s*=', Name.Attribute, 'pyattr'),
+ (r'[\w:-]+\s*=', Name.Attribute, 'attr'),
(r'/?\s*>', Name.Tag, '#pop'),
],
'attr': [
@@ -907,7 +907,7 @@ class GenshiMarkupLexer(RegexLexer):
'variable': [
(r'(?<!\$)(\$\{)(.+?)(\})',
bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
- (r'(?<!\$)(\$)([a-zA-Z_][a-zA-Z0-9_\.]*)',
+ (r'(?<!\$)(\$)([a-zA-Z_][\w\.]*)',
Name.Variable),
]
}
@@ -1504,9 +1504,9 @@ class ColdfusionLexer(RegexLexer):
(r'(true|false|null)\b', Keyword.Constant),
(r'(application|session|client|cookie|super|this|variables|arguments)\b',
Name.Constant),
- (r'([A-Za-z_$][A-Za-z0-9_.]*)(\s*)(\()',
+ (r'([A-Za-z_$][\w.]*)(\s*)(\()',
bygroups(Name.Function, Text, Punctuation)),
- (r'[A-Za-z_$][A-Za-z0-9_.]*', Name.Variable),
+ (r'[A-Za-z_$][\w.]*', Name.Variable),
(r'[()\[\]{};:,.\\]', Punctuation),
(r'\s+', Text),
],
@@ -1805,7 +1805,7 @@ class HandlebarsLexer(RegexLexer):
# borrowed from DjangoLexer
(r':?"(\\\\|\\"|[^"])*"', String.Double),
(r":?'(\\\\|\\'|[^'])*'", String.Single),
- (r'[a-zA-Z][a-zA-Z0-9_-]*', Name.Variable),
+ (r'[a-zA-Z][\w-]*', Name.Variable),
(r'\.\w+', Name.Variable),
(r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
r"0[xX][0-9a-fA-F]+[Ll]?", Number),