summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-06-07 08:34:07 -0700
committerTim Hatch <tim@timhatch.com>2014-06-07 08:34:07 -0700
commit260e2a3641b2822b39354754805a13b67b193279 (patch)
tree556eb7eb47ec8342165851eb87c8ff8f5dc1fa6b
parent3340ad5559b2f2e35588cb6a5eda07df66e4929d (diff)
downloadpygments-260e2a3641b2822b39354754805a13b67b193279.tar.gz
Cleanups by regexlint for #977
-rw-r--r--pygments/lexers/templates.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py
index 2de19b4c..3965e953 100644
--- a/pygments/lexers/templates.py
+++ b/pygments/lexers/templates.py
@@ -1866,14 +1866,14 @@ class LiquidLexer(RegexLexer):
tokens = {
'root': [
- (r'[^\{]+', Text),
+ (r'[^{]+', Text),
# tags and block tags
(r'(\{%)(\s*)', bygroups(Punctuation, Whitespace), 'tag-or-block'),
# output tags
- (r'(\{\{)(\s*)([^\s(\}\})]+)',
+ (r'({{)(\s*)([^\s}]+)',
bygroups(Punctuation, Whitespace, using(this, state = 'generic')),
'output'),
- (r'\{', Text)
+ (r'{', Text)
],
'tag-or-block': [
@@ -1900,8 +1900,8 @@ class LiquidLexer(RegexLexer):
bygroups(Name.Tag, None, Whitespace, Punctuation), '#pop'),
# builtin tags (assign and include are handled together with usual tags)
- (r'(cycle)(\s+)(([^\s:]*)(:))?(\s*)',
- bygroups(Name.Tag, Whitespace, None,
+ (r'(cycle)(\s+)(?:([^\s:]*)(:))?(\s*)',
+ bygroups(Name.Tag, Whitespace,
using(this, state='generic'), Punctuation, Whitespace),
'variable-tag-markup'),
@@ -1934,11 +1934,12 @@ class LiquidLexer(RegexLexer):
include('end-of-block'),
include('whitespace'),
- (r'([^\s=!><]+)(\s*)([=!><]=?)(\s*)([^\s]+)(\s*)(%\})',
+ (r'([^\s=!><]+)(\s*)([=!><]=?)(\s*)(\S+)(\s*)(%\})',
bygroups(using(this, state = 'generic'), Whitespace, Operator,
Whitespace, using(this, state = 'generic'), Whitespace,
Punctuation)),
- (r'\b((!)|(not\b))', bygroups(None, Operator, Operator.Word)),
+ (r'\b!', Operator),
+ (r'\bnot\b', Operator.Word),
(r'([\w\.\'"]+)(\s+)(contains)(\s+)([\w\.\'"]+)',
bygroups(using(this, state = 'generic'), Whitespace, Operator.Word,
Whitespace, using(this, state = 'generic'))),