diff options
author | Georg Brandl <georg@python.org> | 2014-10-15 21:32:31 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-10-15 21:32:31 +0200 |
commit | 10be9bec8a7969a40d4fa3483b8317e0131b1715 (patch) | |
tree | 7047dd543253b4a5f0002c377cce59e3589a2aeb /pygments/lexers/resource.py | |
parent | 6095eb22ab78b1754aeb56d67754cc4cb401e843 (diff) | |
download | pygments-10be9bec8a7969a40d4fa3483b8317e0131b1715.tar.gz |
all lexers: fix unescaped { and } so that the "regex" module can compile our regexes
Diffstat (limited to 'pygments/lexers/resource.py')
-rw-r--r-- | pygments/lexers/resource.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pygments/lexers/resource.py b/pygments/lexers/resource.py index 78bee786..6a9e702e 100644 --- a/pygments/lexers/resource.py +++ b/pygments/lexers/resource.py @@ -41,15 +41,15 @@ class ResourceLexer(RegexLexer): 'string': [ (r'(\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}|\\U00[0-9a-fA-F]{6}|' r'\\[0-7]{1,3}|\\c.|\\[abtnvfre\'"?\\]|\\{|[^"{\\])+', String), - (r'{', String.Escape, 'msgname'), + (r'\{', String.Escape, 'msgname'), (r'"', String, '#pop') ], 'msgname': [ (r'([^{},]+)(\s*)', bygroups(Name, String.Escape), ('#pop', 'message')) ], 'message': [ - (r'{', String.Escape, 'msgname'), - (r'}', String.Escape, '#pop'), + (r'\{', String.Escape, 'msgname'), + (r'\}', String.Escape, '#pop'), (r'(,)(\s*)([a-zA-Z]+)(\s*})', bygroups(Operator, String.Escape, Keyword, String.Escape), '#pop'), (r'(,)(\s*)([a-zA-Z]+)(\s*)(,)(\s*)(offset)(\s*)(:)(\s*)(-?\d+)(\s*)', @@ -65,12 +65,12 @@ class ResourceLexer(RegexLexer): (r'(=|<|>|<=|>=|!=)(-?\d+)(\s*{)', bygroups(Operator, Number.Integer, String.Escape), 'message'), (r'([a-zA-Z]+)(\s*{)', bygroups(Keyword.Type, String.Escape), 'str'), - (r'}', String.Escape, ('#pop', '#pop')), + (r'\}', String.Escape, ('#pop', '#pop')), (r'\s+', String.Escape) ], 'str': [ - (r'}', String.Escape, '#pop'), - (r'{', String.Escape, 'msgname'), + (r'\}', String.Escape, '#pop'), + (r'\{', String.Escape, 'msgname'), (r'[^{}]+', String) ] } |