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 | |
parent | 6095eb22ab78b1754aeb56d67754cc4cb401e843 (diff) | |
download | pygments-10be9bec8a7969a40d4fa3483b8317e0131b1715.tar.gz |
all lexers: fix unescaped { and } so that the "regex" module can compile our regexes
34 files changed, 183 insertions, 182 deletions
diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst index 6ea08dba..23bcb4f7 100644 --- a/doc/docs/lexerdevelopment.rst +++ b/doc/docs/lexerdevelopment.rst @@ -323,7 +323,7 @@ There are a few more things you can do with states: (r'[^}/]+', Text), include('comments'), (r'/', Text), - (r'}', Keyword, '#pop'), + (r'\}', Keyword, '#pop'), ] } diff --git a/pygments/lexers/business.py b/pygments/lexers/business.py index e2806664..4be1fd4a 100644 --- a/pygments/lexers/business.py +++ b/pygments/lexers/business.py @@ -475,8 +475,8 @@ class OpenEdgeLexer(RegexLexer): ], 'preprocessor': [ (r'[^{}]', Comment.Preproc), - (r'{', Comment.Preproc, '#push'), - (r'}', Comment.Preproc, '#pop'), + (r'\{', Comment.Preproc, '#push'), + (r'\}', Comment.Preproc, '#pop'), ], } diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py index ac9cc7b8..86927b0e 100644 --- a/pygments/lexers/c_cpp.py +++ b/pygments/lexers/c_cpp.py @@ -110,8 +110,8 @@ class CFamilyLexer(RegexLexer): include('whitespace'), include('statements'), (';', Punctuation), - ('{', Punctuation, '#push'), - ('}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), ], 'string': [ (r'"', String, '#pop'), diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py index 44475357..df346609 100644 --- a/pygments/lexers/configs.py +++ b/pygments/lexers/configs.py @@ -452,12 +452,12 @@ class NginxConfLexer(RegexLexer): include('base'), ], 'block': [ - (r'}', Punctuation, '#pop:2'), + (r'\}', Punctuation, '#pop:2'), (r'[^\s;#]+', Keyword.Namespace, 'stmt'), include('base'), ], 'stmt': [ - (r'{', Punctuation, 'block'), + (r'\{', Punctuation, 'block'), (r';', Punctuation, '#pop'), include('base'), ], diff --git a/pygments/lexers/console.py b/pygments/lexers/console.py index 334e7195..68aa70e2 100644 --- a/pygments/lexers/console.py +++ b/pygments/lexers/console.py @@ -55,8 +55,8 @@ class PyPyLogLexer(RegexLexer): tokens = { "root": [ - (r"\[\w+\] {jit-log-.*?$", Keyword, "jit-log"), - (r"\[\w+\] {jit-backend-counts$", Keyword, "jit-backend-counts"), + (r"\[\w+\] \{jit-log-.*?$", Keyword, "jit-log"), + (r"\[\w+\] \{jit-backend-counts$", Keyword, "jit-backend-counts"), include("extra-stuff"), ], "jit-log": [ diff --git a/pygments/lexers/css.py b/pygments/lexers/css.py index 091d4696..61a08d4b 100644 --- a/pygments/lexers/css.py +++ b/pygments/lexers/css.py @@ -38,7 +38,7 @@ class CssLexer(RegexLexer): 'basics': [ (r'\s+', Text), (r'/\*(?:.|\n)*?\*/', Comment), - (r'{', Punctuation, 'content'), + (r'\{', Punctuation, 'content'), (r'\:[\w-]+', Name.Decorator), (r'\.[\w-]+', Name.Class), (r'\#[\w-]+', Name.Function), @@ -49,17 +49,17 @@ class CssLexer(RegexLexer): (r"'(\\\\|\\'|[^'])*'", String.Single) ], 'atrule': [ - (r'{', Punctuation, 'atcontent'), + (r'\{', Punctuation, 'atcontent'), (r';', Punctuation, '#pop'), include('basics'), ], 'atcontent': [ include('basics'), - (r'}', Punctuation, '#pop:2'), + (r'\}', Punctuation, '#pop:2'), ], 'content': [ (r'\s+', Text), - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), (r'url\(.*?\)', String.Other), (r'^@.*?$', Comment.Preproc), (words(( @@ -268,7 +268,7 @@ common_sass_tokens = { (r'\#[a-z0-9]{1,6}', Number.Hex), (r'(-?\d+)(\%|[a-z]+)?', bygroups(Number.Integer, Keyword.Type)), (r'(-?\d*\.\d+)(\%|[a-z]+)?', bygroups(Number.Float, Keyword.Type)), - (r'#{', String.Interpol, 'interpolation'), + (r'#\{', String.Interpol, 'interpolation'), (r'[~\^\*!&%<>\|+=@:,./?-]+', Operator), (r'[\[\]()]+', Punctuation), (r'"', String.Double, 'string-double'), @@ -426,14 +426,14 @@ class SassLexer(ExtendedRegexLexer): 'old-style-attr': [ (r'[^\s:="\[]+', Name.Attribute), - (r'#{', String.Interpol, 'interpolation'), + (r'#\{', String.Interpol, 'interpolation'), (r'[ \t]*=', Operator, 'value'), default('value'), ], 'new-style-attr': [ (r'[^\s:="\[]+', Name.Attribute), - (r'#{', String.Interpol, 'interpolation'), + (r'#\{', String.Interpol, 'interpolation'), (r'[ \t]*[=:]', Operator, 'value'), ], @@ -480,7 +480,7 @@ class ScssLexer(RegexLexer): 'attr': [ (r'[^\s:="\[]+', Name.Attribute), - (r'#{', String.Interpol, 'interpolation'), + (r'#\{', String.Interpol, 'interpolation'), (r'[ \t]*:', Operator, 'value'), ], diff --git a/pygments/lexers/d.py b/pygments/lexers/d.py index c3c3dc1d..3337e66a 100644 --- a/pygments/lexers/d.py +++ b/pygments/lexers/d.py @@ -104,11 +104,11 @@ class DLexer(RegexLexer): (r'q"\[', String, 'delimited_bracket'), (r'q"\(', String, 'delimited_parenthesis'), (r'q"<', String, 'delimited_angle'), - (r'q"{', String, 'delimited_curly'), + (r'q"\{', String, 'delimited_curly'), (r'q"([a-zA-Z_]\w*)\n.*?\n\1"', String), (r'q"(.).*?\1"', String), # -- TokenString - (r'q{', String, 'token_string'), + (r'q\{', String, 'token_string'), # Attributes (r'@([a-zA-Z_]\w*)?', Name.Decorator), # Tokens @@ -127,13 +127,13 @@ class DLexer(RegexLexer): (r'[+/]', Comment.Multiline), ], 'token_string': [ - (r'{', Punctuation, 'token_string_nest'), - (r'}', String, '#pop'), + (r'\{', Punctuation, 'token_string_nest'), + (r'\}', String, '#pop'), include('root'), ], 'token_string_nest': [ - (r'{', Punctuation, '#push'), - (r'}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), include('root'), ], 'delimited_bracket': [ @@ -168,13 +168,13 @@ class DLexer(RegexLexer): ], 'delimited_curly': [ (r'[^{}]+', String), - (r'{', String, 'delimited_inside_curly'), - (r'}"', String, '#pop'), + (r'\{', String, 'delimited_inside_curly'), + (r'\}"', String, '#pop'), ], 'delimited_inside_curly': [ (r'[^{}]+', String), - (r'{', String, '#push'), - (r'}', String, '#pop'), + (r'\{', String, '#push'), + (r'\}', String, '#pop'), ], } diff --git a/pygments/lexers/data.py b/pygments/lexers/data.py index 6ea331f6..22821c15 100644 --- a/pygments/lexers/data.py +++ b/pygments/lexers/data.py @@ -476,14 +476,14 @@ class JsonLexer(RegexLexer): # comma terminates the attribute but expects more (r',', Punctuation, '#pop'), # a closing bracket terminates the entire object, so pop twice - (r'}', Punctuation, ('#pop', '#pop')), + (r'\}', Punctuation, ('#pop', '#pop')), ], # a json object - { attr, attr, ... } 'objectvalue': [ include('whitespace'), (r'"(\\\\|\\"|[^"])*"', Name.Tag, 'objectattribute'), - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), ], # json array - [ value, value, ... } @@ -491,14 +491,14 @@ class JsonLexer(RegexLexer): include('whitespace'), include('value'), (r',', Punctuation), - (r']', Punctuation, '#pop'), + (r'\]', Punctuation, '#pop'), ], # a json value - either a simple value or a complex value (object or array) 'value': [ include('whitespace'), include('simplevalue'), - (r'{', Punctuation, 'objectvalue'), + (r'\{', Punctuation, 'objectvalue'), (r'\[', Punctuation, 'arrayvalue'), ], diff --git a/pygments/lexers/diff.py b/pygments/lexers/diff.py index fe6435c5..a910a979 100644 --- a/pygments/lexers/diff.py +++ b/pygments/lexers/diff.py @@ -68,8 +68,8 @@ class DarcsPatchLexer(RegexLexer): 'root': [ (r'<', Operator), (r'>', Operator), - (r'{', Operator), - (r'}', Operator), + (r'\{', Operator), + (r'\}', Operator), (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)(\])', bygroups(Operator, Keyword, Name, Text, Name, Operator, Literal.Date, Text, Operator)), diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py index b26f6843..204b4a71 100644 --- a/pygments/lexers/dotnet.py +++ b/pygments/lexers/dotnet.py @@ -570,7 +570,7 @@ class FSharpLexer(RegexLexer): '!=', '#', '&&', '&', '\(', '\)', '\*', '\+', ',', '-\.', '->', '-', '\.\.', '\.', '::', ':=', ':>', ':', ';;', ';', '<-', '<\]', '<', '>\]', '>', '\?\?', '\?', '\[<', '\[\|', '\[', '\]', - '_', '`', '{', '\|\]', '\|', '}', '~', '<@@', '<@', '=', '@>', '@@>', + '_', '`', '\{', '\|\]', '\|', '\}', '~', '<@@', '<@', '=', '@>', '@@>', ] operators = r'[!$%&*+\./:<=>?@^|~-]' diff --git a/pygments/lexers/dsls.py b/pygments/lexers/dsls.py index e059ecfd..dcd15011 100644 --- a/pygments/lexers/dsls.py +++ b/pygments/lexers/dsls.py @@ -462,7 +462,7 @@ class PanLexer(RegexLexer): 'root': [ include('basic'), (r'\(', Keyword, 'paren'), - (r'{', Keyword, 'curly'), + (r'\{', Keyword, 'curly'), include('data'), ], 'basic': [ @@ -496,7 +496,7 @@ class PanLexer(RegexLexer): (r'\d+(?= |\Z)', Number), ], 'curly': [ - (r'}', Keyword, '#pop'), + (r'\}', Keyword, '#pop'), (r':-', Keyword), (r'\w+', Name.Variable), (r'[^}:"\'`$]+', Punctuation), diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py index b8ed7ff2..ccd94564 100644 --- a/pygments/lexers/erlang.py +++ b/pygments/lexers/erlang.py @@ -323,9 +323,9 @@ class ElixirLexer(RegexLexer): name_re = r'(?:\.\.\.|[a-z_]%s*[!\?]?)' % alnum modname_re = r'[A-Z]%(alnum)s*(?:\.[A-Z]%(alnum)s*)*' % {'alnum': alnum} complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re) - special_atom_re = r'(?:\.\.\.|<<>>|%{}|%|{})' + special_atom_re = r'(?:\.\.\.|<<>>|%\{\}|%|\{\})' - long_hex_char_re = r'(\\x{)([\da-fA-F]+)(})' + long_hex_char_re = r'(\\x\{)([\da-fA-F]+)(\})' hex_char_re = r'(\\x[\da-fA-F]{1,2})' escape_char_re = r'(\\[abdefnrstv])' @@ -387,8 +387,8 @@ class ElixirLexer(RegexLexer): include('sigils'), - (r'%{', Punctuation, 'map_key'), - (r'{', Punctuation, 'tuple'), + (r'%\{', Punctuation, 'map_key'), + (r'\{', Punctuation, 'tuple'), ], 'heredoc_double': [ (r'^\s*"""', String.Heredoc, '#pop'), @@ -417,17 +417,17 @@ class ElixirLexer(RegexLexer): (escape_char_re, String.Escape), ], 'interpol': [ - (r'#{', String.Interpol, 'interpol_string'), + (r'#\{', String.Interpol, 'interpol_string'), ], 'interpol_string': [ - (r'}', String.Interpol, "#pop"), + (r'\}', String.Interpol, "#pop"), include('root') ], 'map_key': [ include('root'), (r':', Punctuation, 'map_val'), (r'=>', Punctuation, 'map_val'), - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), ], 'map_val': [ include('root'), @@ -436,7 +436,7 @@ class ElixirLexer(RegexLexer): ], 'tuple': [ include('root'), - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), ], } tokens.update(gen_elixir_string_rules('double', '"', String.Double)) diff --git a/pygments/lexers/fantom.py b/pygments/lexers/fantom.py index fd850336..c05cb8e8 100644 --- a/pygments/lexers/fantom.py +++ b/pygments/lexers/fantom.py @@ -215,7 +215,7 @@ class FantomLexer(RegexLexer): (r':|,', Punctuation), (r'(?:(\w+)(::))?(\w+)', bygroups(Name.Namespace, Punctuation, Name.Class)), - (r'{', Punctuation, '#pop') + (r'\{', Punctuation, '#pop') ], 'using': [ (r'[ \t]+', Text), # consume whitespaces @@ -235,7 +235,7 @@ class FantomLexer(RegexLexer): ], 'facet': [ (r'\s+', Text), - (r'{', Punctuation, 'facetFields'), + (r'\{', Punctuation, 'facetFields'), default('#pop') ], 'facetFields': [ @@ -244,7 +244,7 @@ class FantomLexer(RegexLexer): include('operators'), (r'\s+', Text), (r'(\s*)(\w+)(\s*)(=)', bygroups(Text, Name, Text, Operator)), - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), (r'.', Text) ], } diff --git a/pygments/lexers/graphics.py b/pygments/lexers/graphics.py index bed5f182..4ed12705 100644 --- a/pygments/lexers/graphics.py +++ b/pygments/lexers/graphics.py @@ -263,8 +263,8 @@ class AsymptoteLexer(RegexLexer): include('whitespace'), include('statements'), (';', Punctuation), - ('{', Punctuation, '#push'), - ('}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), ], 'string': [ (r"'", String, '#pop'), diff --git a/pygments/lexers/installers.py b/pygments/lexers/installers.py index 54369da1..53a7abc1 100644 --- a/pygments/lexers/installers.py +++ b/pygments/lexers/installers.py @@ -309,7 +309,7 @@ class DebianControlLexer(RegexLexer): (r'\|', Operator), (r'[\s]+', Text), (r'[}\)]\s*$', Text, '#pop'), - (r'}', Text), + (r'\}', Text), (r'[^,]$', Name.Function, '#pop'), (r'([\+\.a-zA-Z0-9-])(\s*)', bygroups(Name.Function, Text)), (r'\[.*?\]', Name.Entity), diff --git a/pygments/lexers/int_fiction.py b/pygments/lexers/int_fiction.py index cbac9e39..8c3a934c 100644 --- a/pygments/lexers/int_fiction.py +++ b/pygments/lexers/int_fiction.py @@ -848,7 +848,7 @@ class Tads3Lexer(RegexLexer): tokens = { 'root': [ (u'\ufeff', Text), - (r'{', Punctuation, 'object-body'), + (r'\{', Punctuation, 'object-body'), (r';+', Punctuation), (r'(?=(argcount|break|case|catch|continue|default|definingobj|' r'delegated|do|else|for|foreach|finally|goto|if|inherited|' @@ -869,13 +869,13 @@ class Tads3Lexer(RegexLexer): ], 'object-body/no-braces': [ (r';', Punctuation, '#pop'), - (r'{', Punctuation, ('#pop', 'object-body')), + (r'\{', Punctuation, ('#pop', 'object-body')), include('object-body') ], 'object-body': [ (r';', Punctuation), - (r'{', Punctuation, '#push'), - (r'}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), (r':', Punctuation, ('classes', 'class')), (r'(%s?)(%s*)(\()' % (_name, _ws), bygroups(Name.Function, using(this, state='whitespace'), @@ -900,7 +900,7 @@ class Tads3Lexer(RegexLexer): default('#pop:2') ], 'block?/root': [ - (r'{', Punctuation, ('#pop', 'block')), + (r'\{', Punctuation, ('#pop', 'block')), include('whitespace'), (r'(?=[[\'"<(:])', Text, # It might be a VerbRule macro. ('#pop', 'object-body/no-braces', 'grammar', 'grammar-rules')), @@ -908,14 +908,14 @@ class Tads3Lexer(RegexLexer): default(('#pop', 'object-body/no-braces')) ], 'block?': [ - (r'{', Punctuation, ('#pop', 'block')), + (r'\{', Punctuation, ('#pop', 'block')), include('whitespace'), default('#pop') ], 'block/basic': [ (r'[;:]+', Punctuation), - (r'{', Punctuation, '#push'), - (r'}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), (r'default\b', Keyword.Reserved), (r'(%s)(%s*)(:)' % (_name, _ws), bygroups(Name.Label, using(this, state='whitespace'), @@ -935,8 +935,8 @@ class Tads3Lexer(RegexLexer): include('whitespace'), (r'\(', Punctuation, ('#pop', 'more', 'main')), (r'\[', Punctuation, ('#pop', 'more/list', 'main')), - (r'{', Punctuation, ('#pop', 'more/inner', 'main/inner', - 'more/parameters', 'main/parameters')), + (r'\{', Punctuation, ('#pop', 'more/inner', 'main/inner', + 'more/parameters', 'main/parameters')), (r'\*|\.{3}', Punctuation, '#pop'), (r'(?i)0x[\da-f]+', Number.Hex, '#pop'), (r'(\d+\.(?!\.)\d*|\.\d+)([eE][-+]?\d+)?|\d+[eE][-+]?\d+', @@ -1057,7 +1057,7 @@ class Tads3Lexer(RegexLexer): include('main') ], 'more/inner': [ - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), (r',', Punctuation, 'main/inner'), (r'(in|step)\b', Keyword, 'main/inner'), include('more') @@ -1175,7 +1175,7 @@ class Tads3Lexer(RegexLexer): ], 'propertyset': [ (r'\(', Punctuation, ('more/parameters', 'main/parameters')), - (r'{', Punctuation, ('#pop', 'object-body')), + (r'\{', Punctuation, ('#pop', 'object-body')), include('whitespace') ], 'template': [ diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index 8b5f9c76..481243ef 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -22,6 +22,7 @@ __all__ = ['JavascriptLexer', 'KalLexer', 'LiveScriptLexer', 'DartLexer', 'TypeScriptLexer', 'LassoLexer', 'ObjectiveJLexer', 'CoffeeScriptLexer', 'MaskLexer'] + JS_IDENT_START = ('(?:[$_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Lo + uni.Nl + ']|\\\\u[a-fA-F0-9]{4})') JS_IDENT_PART = ('(?:[$_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Lo + uni.Nl @@ -29,6 +30,7 @@ JS_IDENT_PART = ('(?:[$_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Lo + uni.Nl + u'\u200c\u200d]|\\\\u[a-fA-F0-9]{4})') JS_IDENT = JS_IDENT_START + '(?:' + JS_IDENT_PART + ')*' + class JavascriptLexer(RegexLexer): """ For JavaScript source code. @@ -178,13 +180,13 @@ class KalLexer(RegexLexer): # hashmarks, quotes and backslashes must be parsed one at a time ], 'interpoling_string': [ - (r'}', String.Interpol, "#pop"), + (r'\}', String.Interpol, "#pop"), include('root') ], 'dqs': [ (r'"', String, '#pop'), (r'\\.|\'', String), # double-quoted string don't need ' escapes - (r'#{', String.Interpol, "interpoling_string"), + (r'#\{', String.Interpol, "interpoling_string"), include('strings') ], 'sqs': [ @@ -195,7 +197,7 @@ class KalLexer(RegexLexer): 'tdqs': [ (r'"""', String, '#pop'), (r'\\.|\'|"', String), # no need to escape quotes in triple-string - (r'#{', String.Interpol, "interpoling_string"), + (r'#\{', String.Interpol, "interpoling_string"), include('strings'), ], 'tsqs': [ @@ -287,13 +289,13 @@ class LiveScriptLexer(RegexLexer): # hashmarks, quotes and backslashes must be parsed one at a time ], 'interpoling_string': [ - (r'}', String.Interpol, "#pop"), + (r'\}', String.Interpol, "#pop"), include('root') ], 'dqs': [ (r'"', String, '#pop'), (r'\\.|\'', String), # double-quoted string don't need ' escapes - (r'#{', String.Interpol, "interpoling_string"), + (r'#\{', String.Interpol, "interpoling_string"), (r'#', String), include('strings') ], @@ -305,7 +307,7 @@ class LiveScriptLexer(RegexLexer): 'tdqs': [ (r'"""', String, '#pop'), (r'\\.|\'|"', String), # no need to escape quotes in triple-string - (r'#{', String.Interpol, "interpoling_string"), + (r'#\{', String.Interpol, "interpoling_string"), (r'#', String), include('strings'), ], @@ -1000,7 +1002,7 @@ class CoffeeScriptLexer(RegexLexer): 'multilineregex': [ (r'[^/#]+', String.Regex), (r'///([gim]+\b|\B)', String.Regex, '#pop'), - (r'#{', String.Interpol, 'interpoling_string'), + (r'#\{', String.Interpol, 'interpoling_string'), (r'[/#]', String.Regex), ], 'slashstartsregex': [ @@ -1054,13 +1056,13 @@ class CoffeeScriptLexer(RegexLexer): # hashmarks, quotes and backslashes must be parsed one at a time ], 'interpoling_string': [ - (r'}', String.Interpol, "#pop"), + (r'\}', String.Interpol, "#pop"), include('root') ], 'dqs': [ (r'"', String, '#pop'), (r'\\.|\'', String), # double-quoted string don't need ' escapes - (r'#{', String.Interpol, "interpoling_string"), + (r'#\{', String.Interpol, "interpoling_string"), (r'#', String), include('strings') ], @@ -1072,7 +1074,7 @@ class CoffeeScriptLexer(RegexLexer): 'tdqs': [ (r'"""', String, '#pop'), (r'\\.|\'|"', String), # no need to escape quotes in triple-string - (r'#{', String.Interpol, "interpoling_string"), + (r'#\{', String.Interpol, "interpoling_string"), (r'#', String), include('strings'), ], diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index 136a0fd7..898cf415 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -289,7 +289,7 @@ class ScalaLexer(RegexLexer): (u'(%s|%s|`[^`]+`)(\\s*)(\\[)' % (idrest, op), bygroups(Name.Class, Text, Operator), 'typeparam'), (r'\s+', Text), - (r'{', Operator, '#pop'), + (r'\{', Operator, '#pop'), (r'\(', Operator, '#pop'), (r'//.*?\n', Comment.Single, '#pop'), (u'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'), @@ -530,7 +530,7 @@ class IokeLexer(RegexLexer): 'interpolatableText': [ (r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}' r'|\\[0-3]?[0-7]?[0-7])', String.Escape), - (r'#{', Punctuation, 'textInterpolationRoot') + (r'#\{', Punctuation, 'textInterpolationRoot') ], 'text': [ @@ -546,7 +546,7 @@ class IokeLexer(RegexLexer): ], 'textInterpolationRoot': [ - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), include('root') ], @@ -695,7 +695,7 @@ class IokeLexer(RegexLexer): Operator), # Punctuation - (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|{|})', Punctuation), + (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|\{|\})', Punctuation), # kinds (r'[A-Z][\w!:?]*', Name.Class), @@ -1268,7 +1268,7 @@ class GoloLexer(RegexLexer): (r'[\'"\\]', String) ], 'stringescape': [ - (r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|' + (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|' r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape) ], 'triplestring': [ diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py index a0a08efe..c9a82d8e 100644 --- a/pygments/lexers/lisp.py +++ b/pygments/lexers/lisp.py @@ -120,7 +120,7 @@ class SchemeLexer(RegexLexer): # strings, symbols and characters (r'"(\\\\|\\"|[^"])*"', String), (r"'" + valid_name, String.Symbol), - (r"#\\([()/'\"._!§$%& ?=+-]{1}|[a-zA-Z0-9]+)", String.Char), + (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char), # constants (r'(#t|#f)', Name.Constant), @@ -1444,7 +1444,7 @@ class NewLispLexer(RegexLexer): (r'"(\\\\|\\"|[^"])*"', String), # braces - (r"{", String, "bracestring"), + (r'\{', String, "bracestring"), # [text] ... [/text] delimited strings (r'\[text\]*', String, "tagstring"), @@ -1468,9 +1468,9 @@ class NewLispLexer(RegexLexer): # braced strings... 'bracestring': [ - ("{", String, "#push"), - ("}", String, "#pop"), - ("[^{}]+", String), + (r'\{', String, "#push"), + (r'\}', String, "#pop"), + ('[^{}]+', String), ], # tagged [text]...[/text] delimited strings... diff --git a/pygments/lexers/markup.py b/pygments/lexers/markup.py index 285c1350..75236a61 100644 --- a/pygments/lexers/markup.py +++ b/pygments/lexers/markup.py @@ -22,7 +22,7 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ from pygments.util import get_bool_opt, ClassNotFound __all__ = ['BBCodeLexer', 'MoinWikiLexer', 'RstLexer', 'TexLexer', 'GroffLexer', - 'MozPreprocHashLexer', 'MozPreprocPercentLexer', + 'MozPreprocHashLexer', 'MozPreprocPercentLexer', 'MozPreprocXulLexer', 'MozPreprocJavascriptLexer', 'MozPreprocCssLexer'] @@ -81,7 +81,7 @@ class MoinWikiLexer(RegexLexer): (r'^(=+)([^=]+)(=+)(\s*#.+)?$', bygroups(Generic.Heading, using(this), Generic.Heading, String)), # Literal code blocks, with optional shebang - (r'({{{)(\n#!.+)?', bygroups(Name.Builtin, Name.Namespace), 'codeblock'), + (r'(\{\{\{)(\n#!.+)?', bygroups(Name.Builtin, Name.Namespace), 'codeblock'), (r'(\'\'\'?|\|\||`|__|~~|\^|,,|::)', Comment), # Formatting # Lists (r'^( +)([.*-])( )', bygroups(Text, Name.Builtin, Text)), @@ -98,7 +98,7 @@ class MoinWikiLexer(RegexLexer): 'codeblock': [ (r'}}}', Name.Builtin, '#pop'), # these blocks are allowed to be nested in Trac, but not MoinMoin - (r'{{{', Text, '#push'), + (r'\{\{\{', Text, '#push'), (r'[^{}]+', Comment.Preproc), # slurp boring text (r'.', Comment.Preproc), # allow loose { or } ], @@ -441,7 +441,6 @@ class MozPreprocPercentLexer(MozPreprocHashLexer): filenames = [] mimetypes = [] - tokens = { 'root': [ (r'^%', Comment.Preproc, ('expr', 'exprstart')), diff --git a/pygments/lexers/ml.py b/pygments/lexers/ml.py index 81de39b9..c2d2bb12 100644 --- a/pygments/lexers/ml.py +++ b/pygments/lexers/ml.py @@ -113,8 +113,8 @@ class SMLLexer(RegexLexer): # the `|' is resolved - is it a case/handle expression, or function # definition by cases? (This is not how the Definition works, but # it's how MLton behaves, see http://mlton.org/SMLNJDeviations) - (r'\(|\[|{', Punctuation, 'main'), - (r'\)|\]|}', Punctuation, '#pop'), + (r'\(|\[|\{', Punctuation, 'main'), + (r'\)|\]|\}', Punctuation, '#pop'), (r'\b(let|if|local)\b(?!\')', Keyword.Reserved, ('main', 'main')), (r'\b(struct|sig|while)\b(?!\')', Keyword.Reserved, 'main'), (r'\b(do|else|end|in|then)\b(?!\')', Keyword.Reserved, '#pop'), @@ -376,10 +376,10 @@ class OcamlLexer(RegexLexer): 'type', 'value', 'val', 'virtual', 'when', 'while', 'with', ) keyopts = ( - '!=', '#', '&', '&&', '\(', '\)', '\*', '\+', ',', '-', - '-\.', '->', '\.', '\.\.', ':', '::', ':=', ':>', ';', ';;', '<', - '<-', '=', '>', '>]', '>}', '\?', '\?\?', '\[', '\[<', '\[>', '\[\|', - ']', '_', '`', '{', '{<', '\|', '\|]', '}', '~' + '!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-', + r'-\.', '->', r'\.', r'\.\.', ':', '::', ':=', ':>', ';', ';;', '<', + '<-', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>', + r'\[\|', ']', '_', '`', r'\{', r'\{<', r'\|', r'\|]', r'\}', '~' ) operators = r'[!$%&*+\./:<=>?@^|~-]' @@ -526,8 +526,8 @@ class OpaLexer(RegexLexer): # inside a string, we are back in the string state # as a consequence, we must also push a state every time we find a # '{' or else we will have errors when parsing {} for instance - (r'{', Operator, '#push'), - (r'}', Operator, '#pop'), + (r'\{', Operator, '#push'), + (r'\}', Operator, '#pop'), # html literals # this is a much more strict that the actual parser, @@ -569,7 +569,7 @@ class OpaLexer(RegexLexer): # id literal, #something, or #{expr} (r'#'+ident_re, String.Single), - (r'#(?={)', String.Single), + (r'#(?=\{)', String.Single), # identifiers # this avoids to color '2' in 'a2' as an integer @@ -608,7 +608,7 @@ class OpaLexer(RegexLexer): 'type-1': [ include('comments-and-spaces'), (r'\(', Keyword.Type, ('#pop', 'type-tuple')), - (r'~?{', Keyword.Type, ('#pop', 'type-record')), + (r'~?\{', Keyword.Type, ('#pop', 'type-record')), (ident_re+r'\(', Keyword.Type, ('#pop', 'type-tuple')), (ident_re, Keyword.Type, '#pop'), ("'"+ident_re, Keyword.Type), @@ -671,8 +671,8 @@ class OpaLexer(RegexLexer): include('comments-and-spaces'), (r'[^{}/*]+', Keyword.Type), (r'[/*]', Keyword.Type), - (r'{', Keyword.Type, '#push'), - (r'}', Keyword.Type, '#pop'), + (r'\{', Keyword.Type, '#push'), + (r'\}', Keyword.Type, '#pop'), ], # 'type-tuple': [ @@ -687,7 +687,7 @@ class OpaLexer(RegexLexer): # ], # 'type-record':[ # include('comments-and-spaces'), - # (r'}', Keyword.Type, '#pop'), + # (r'\}', Keyword.Type, '#pop'), # (r'~?(?:\w+|`[^`]*`)', Keyword.Type, 'type-record-field-expr'), # ], # 'type-record-field-expr': [ @@ -706,13 +706,13 @@ class OpaLexer(RegexLexer): 'string': [ (r'[^\\"{]+', String.Double), (r'"', String.Double, '#pop'), - (r'{', Operator, 'root'), + (r'\{', Operator, 'root'), include('escape-sequence'), ], 'single-string': [ (r'[^\\\'{]+', String.Double), (r'\'', String.Double, '#pop'), - (r'{', Operator, 'root'), + (r'\{', Operator, 'root'), include('escape-sequence'), ], @@ -747,9 +747,9 @@ class OpaLexer(RegexLexer): (r"'", String.Single, ('#pop', 'single-string')), (r'"', String.Single, ('#pop', 'string')), (r'#'+ident_re, String.Single, '#pop'), - (r'#(?={)', String.Single, ('#pop', 'root')), + (r'#(?=\{)', String.Single, ('#pop', 'root')), (r'[^"\'{`=<>]+', String.Single, '#pop'), - (r'{', Operator, ('#pop', 'root')), # this is a tail call! + (r'\{', Operator, ('#pop', 'root')), # this is a tail call! ], # we should probably deal with '\' escapes here @@ -757,7 +757,7 @@ class OpaLexer(RegexLexer): (r'<!--', Comment, 'html-comment'), (r'</', String.Single, ('#pop', 'html-end-tag')), (r'<', String.Single, 'html-open-tag'), - (r'{', Operator, 'root'), + (r'\{', Operator, 'root'), (r'[^<{]+', String.Single), ], diff --git a/pygments/lexers/nit.py b/pygments/lexers/nit.py index 84690cf2..e0947447 100644 --- a/pygments/lexers/nit.py +++ b/pygments/lexers/nit.py @@ -40,16 +40,16 @@ class NitLexer(RegexLexer): 'null', 'as', 'isset', 'label', '__debug__'), suffix=r'(?=[\r\n\t\( ])'), Keyword), (r'[A-Z][A-Za-z0-9_]*', Name.Class), - (r'"""(([^\'\\]|\\.)|\\r|\\n)*(({{?)?(""?{{?)*""""*)', String), # Simple long string + (r'"""(([^\'\\]|\\.)|\\r|\\n)*((\{\{?)?(""?\{\{?)*""""*)', String), # Simple long string (r'\'\'\'(((\\.|[^\'\\])|\\r|\\n)|\'((\\.|[^\'\\])|\\r|\\n)|' r'\'\'((\\.|[^\'\\])|\\r|\\n))*\'\'\'', String), # Simple long string alt - (r'"""(([^\'\\]|\\.)|\\r|\\n)*((""?)?({{?""?)*{{{{*)', String), # Start long string - (r'}}}(((\\.|[^\'\\])|\\r|\\n))*(""?)?({{?""?)*{{{{*', String), # Mid long string - (r'}}}(((\\.|[^\'\\])|\\r|\\n))*({{?)?(""?{{?)*""""*', String), # End long string + (r'"""(([^\'\\]|\\.)|\\r|\\n)*((""?)?(\{\{?""?)*\{\{\{\{*)', String), # Start long string + (r'\}\}\}(((\\.|[^\'\\])|\\r|\\n))*(""?)?(\{\{?""?)*\{\{\{\{*', String), # Mid long string + (r'\}\}\}(((\\.|[^\'\\])|\\r|\\n))*(\{\{?)?(""?\{\{?)*""""*', String), # End long string (r'"(\\.|([^"}{\\]))*"', String), # Simple String - (r'"(\\.|([^"}{\\]))*{', String), # Start string - (r'}(\\.|([^"}{\\]))*{', String), # Mid String - (r'}(\\.|([^"}{\\]))*"', String), # End String + (r'"(\\.|([^"}{\\]))*\{', String), # Start string + (r'\}(\\.|([^"}{\\]))*\{', String), # Mid String + (r'\}(\\.|([^"}{\\]))*"', String), # End String (r'(\'[^\'\\]\')|(\'\\.\')', String.Char), (r'[0-9]+', Number.Integer), (r'[0-9]*.[0-9]+', Number.Float), @@ -58,7 +58,7 @@ class NitLexer(RegexLexer): (r'_[A-Za-z0-9_]+', Name.Variable.Instance), (r'==|!=|<==>|>=|>>|>|<=|<<|<|\+|-|=|/|\*|%|\+=|-=|!|@', Operator), (r'\(|\)|\[|\]|,|\.\.\.|\.\.|\.|::|:', Punctuation), - (r'`{[^`]*`}', Text), # Extern blocks won't be Lexed by Nit + (r'`\{[^`]*`\}', Text), # Extern blocks won't be Lexed by Nit (r'[\r\n\t ]+', Text), ], } diff --git a/pygments/lexers/nix.py b/pygments/lexers/nix.py index 1ac78cde..23171fee 100644 --- a/pygments/lexers/nix.py +++ b/pygments/lexers/nix.py @@ -109,7 +109,7 @@ class NixLexer(RegexLexer): 'doublequote': [ (r'\\', String.Escape), (r'\\"', String.Escape), - (r'\\${', String.Escape), + (r'\\$\{', String.Escape), (r'"', String.Double, '#pop'), (r'\$\{', String.Interpol, 'antiquote'), (r'[^"]', String.Double), diff --git a/pygments/lexers/objective.py b/pygments/lexers/objective.py index df564cf1..a2a3c7f5 100644 --- a/pygments/lexers/objective.py +++ b/pygments/lexers/objective.py @@ -112,8 +112,8 @@ def objective(baselexer): include('whitespace'), include('statements'), (';', Punctuation), - ('{', Punctuation, '#push'), - ('}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), ], 'root': [ # methods @@ -135,7 +135,7 @@ def objective(baselexer): bygroups(using(this), Text, Name.Variable)), (r'[a-zA-Z$_][\w$]*:', Name.Function), (';', Punctuation, '#pop'), - ('{', Punctuation, 'function'), + (r'\{', Punctuation, 'function'), ('', Text, '#pop'), ], 'literal_number': [ diff --git a/pygments/lexers/parsers.py b/pygments/lexers/parsers.py index ad6ad71b..e89602c6 100644 --- a/pygments/lexers/parsers.py +++ b/pygments/lexers/parsers.py @@ -85,7 +85,7 @@ class RagelLexer(RegexLexer): (r'(>|\$|%|<|@|<>)(~|to\b)', Operator), # To-State Actions (r'(>|\$|%|<|@|<>)(\*|from\b)', Operator), # From-State Actions (r'>|@|\$|%', Operator), # Transition Actions and Priorities - (r'\*|\?|\+|{[0-9]*,[0-9]*}', Operator), # Repetition + (r'\*|\?|\+|\{[0-9]*,[0-9]*\}', Operator), # Repetition (r'!|\^', Operator), # Negation (r'\(|\)', Operator), # Grouping ], @@ -97,7 +97,7 @@ class RagelLexer(RegexLexer): include('numbers'), include('identifiers'), include('operators'), - (r'{', Punctuation, 'host'), + (r'\{', Punctuation, 'host'), (r'=', Operator), (r';', Punctuation), ], @@ -121,8 +121,8 @@ class RagelLexer(RegexLexer): r'/', )) + r')+', Other), - (r'{', Punctuation, '#push'), - (r'}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), ], } @@ -167,7 +167,7 @@ class RagelEmbeddedLexer(RegexLexer): Punctuation, Text)), # Multi Line FSM. - (r'(%%%%|%%){', Punctuation, 'multi-line-fsm'), + (r'(%%%%|%%)\{', Punctuation, 'multi-line-fsm'), ], 'multi-line-fsm': [ (r'(' + r'|'.join(( # keep ragel code in largest possible chunks. @@ -364,13 +364,13 @@ class AntlrLexer(RegexLexer): # tokensSpec (r'tokens\b', Keyword, 'tokens'), # attrScope - (r'(scope)(\s*)(' + _id + ')(\s*)({)', + (r'(scope)(\s*)(' + _id + ')(\s*)(\{)', bygroups(Keyword, Whitespace, Name.Variable, Whitespace, Punctuation), 'action'), # exception (r'(catch|finally)\b', Keyword, 'exception'), # action - (r'(@' + _id + ')(\s*)(::)?(\s*)(' + _id + ')(\s*)({)', + (r'(@' + _id + ')(\s*)(::)?(\s*)(' + _id + ')(\s*)(\{)', bygroups(Name.Label, Whitespace, Punctuation, Whitespace, Name.Label, Whitespace, Punctuation), 'action'), # rule @@ -403,12 +403,12 @@ class AntlrLexer(RegexLexer): # ruleScopeSpec - scope followed by target language code or name of action # TODO finish implementing other possibilities for scope # L173 ANTLRv3.g from ANTLR book - (r'(scope)(\s+)({)', bygroups(Keyword, Whitespace, Punctuation), + (r'(scope)(\s+)(\{)', bygroups(Keyword, Whitespace, Punctuation), 'action'), (r'(scope)(\s+)(' + _id + ')(\s*)(;)', bygroups(Keyword, Whitespace, Name.Label, Whitespace, Punctuation)), # ruleAction - (r'(@' + _id + ')(\s*)({)', + (r'(@' + _id + ')(\s*)(\{)', bygroups(Name.Label, Whitespace, Punctuation), 'action'), # finished prelims, go to rule alts! (r':', Punctuation, '#pop') @@ -440,22 +440,22 @@ class AntlrLexer(RegexLexer): 'tokens': [ include('whitespace'), include('comments'), - (r'{', Punctuation), + (r'\{', Punctuation), (r'(' + _TOKEN_REF + r')(\s*)(=)?(\s*)(' + _STRING_LITERAL + ')?(\s*)(;)', bygroups(Name.Label, Whitespace, Punctuation, Whitespace, String, Whitespace, Punctuation)), - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), ], 'options': [ include('whitespace'), include('comments'), - (r'{', Punctuation), + (r'\{', Punctuation), (r'(' + _id + r')(\s*)(=)(\s*)(' + '|'.join((_id, _STRING_LITERAL, _INT, '\*')) + ')(\s*)(;)', bygroups(Name.Variable, Whitespace, Punctuation, Whitespace, Text, Whitespace, Punctuation)), - (r'}', Punctuation, '#pop'), + (r'\}', Punctuation, '#pop'), ], 'action': [ (r'(' + r'|'.join(( # keep host code in largest possible chunks @@ -481,8 +481,8 @@ class AntlrLexer(RegexLexer): (r'(\\)(%)', bygroups(Punctuation, Other)), (r'(\$[a-zA-Z]+)(\.?)(text|value)?', bygroups(Name.Variable, Punctuation, Name.Property)), - (r'{', Punctuation, '#push'), - (r'}', Punctuation, '#pop'), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), ], 'nested-arg-action': [ (r'(' + r'|'.join(( # keep host code in largest possible chunks. @@ -746,17 +746,17 @@ class TreetopBaseLexer(RegexLexer): (r'([0-9]*)(\.\.)([0-9]*)', bygroups(Number.Integer, Operator, Number.Integer)), (r'(<)([^>]+)(>)', bygroups(Punctuation, Name.Class, Punctuation)), - (r'{', Punctuation, 'inline_module'), + (r'\{', Punctuation, 'inline_module'), (r'\.', String.Regex), ], 'inline_module': [ - (r'{', Other, 'ruby'), - (r'}', Punctuation, '#pop'), + (r'\{', Other, 'ruby'), + (r'\}', Punctuation, '#pop'), (r'[^{}]+', Other), ], 'ruby': [ - (r'{', Other, '#push'), - (r'}', Other, '#pop'), + (r'\{', Other, '#push'), + (r'\}', Other, '#pop'), (r'[^{}]+', Other), ], 'space': [ diff --git a/pygments/lexers/perl.py b/pygments/lexers/perl.py index c279f56d..df48e2be 100644 --- a/pygments/lexers/perl.py +++ b/pygments/lexers/perl.py @@ -163,7 +163,7 @@ class PerlLexer(RegexLexer): (r'\s+', Text), # argument declaration (r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Text)), - (r'.*?{', Punctuation, '#pop'), + (r'.*?\{', Punctuation, '#pop'), (r';', Punctuation, '#pop'), ], 'cb-string': [ @@ -545,7 +545,7 @@ class Perl6Lexer(ExtendedRegexLexer): default(('#pop', 'pre-token')), ], 'token': [ - (r'}', Text, '#pop'), + (r'\}', Text, '#pop'), (r'(?<=:)(?:my|our|state|constant|temp|let).*?;', using(this)), # make sure that quotes in character classes aren't treated as strings (r'<(?:[-!?+.]\s*)?\[.*?\]>', String.Regex), diff --git a/pygments/lexers/rebol.py b/pygments/lexers/rebol.py index 6f8dbd2d..7c8e4d73 100644 --- a/pygments/lexers/rebol.py +++ b/pygments/lexers/rebol.py @@ -129,11 +129,11 @@ class RebolLexer(RegexLexer): 'script': [ (r'\s+', Text), (r'#"', String.Char, 'char'), - (r'#{[0-9a-f]*}', Number.Hex), - (r'2#{', Number.Hex, 'bin2'), - (r'64#{[0-9a-z+/=\s]*}', Number.Hex), + (r'#\{[0-9a-f]*\}', Number.Hex), + (r'2#\{', Number.Hex, 'bin2'), + (r'64#\{[0-9a-z+/=\s]*\}', Number.Hex), (r'"', String, 'string'), - (r'{', String, 'string2'), + (r'\{', String, 'string2'), (r';#+.*\n', Comment.Special), (r';\*+.*\n', Comment.Preproc), (r';.*\n', Comment), @@ -151,11 +151,11 @@ class RebolLexer(RegexLexer): (r'[\[\]\(\)]', Generic.Strong), (r'[a-z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url (r'mailto:[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # url - (r'[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # email + (r'[^(\^{"@\s)]+@[^(\^\{"@\s)]+', Name.Decorator), # email (r'comment\s"', Comment, 'commentString1'), - (r'comment\s{', Comment, 'commentString2'), + (r'comment\s\{', Comment, 'commentString2'), (r'comment\s\[', Comment, 'commentBlock'), - (r'comment\s[^(\s{\"\[]+', Comment), + (r'comment\s[^(\s\{\"\[]+', Comment), (r'/[^(\^{^")\s/[\]]*', Name.Attribute), (r'([^(\^{^")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback), (r'<[\w:.-]*>', Name.Tag), @@ -174,8 +174,8 @@ class RebolLexer(RegexLexer): (escape_re, String.Escape), (r'[\(|\)]+', String), (r'\^.', String.Escape), - (r'{', String, '#push'), - (r'}', String, '#pop'), + (r'\{', String, '#push'), + (r'\}', String, '#pop'), ], 'stringFile': [ (r'[^(\^")]+', Name.Decorator), @@ -208,7 +208,7 @@ class RebolLexer(RegexLexer): 'bin2': [ (r'\s+', Number.Hex), (r'([0-1]\s*){8}', Number.Hex), - (r'}', Number.Hex, '#pop'), + (r'\}', Number.Hex, '#pop'), ], 'commentString1': [ (r'[^(\^")]+', Comment), @@ -222,14 +222,14 @@ class RebolLexer(RegexLexer): (escape_re, Comment), (r'[\(|\)]+', Comment), (r'\^.', Comment), - (r'{', Comment, '#push'), - (r'}', Comment, '#pop'), + (r'\{', Comment, '#push'), + (r'\}', Comment, '#pop'), ], 'commentBlock': [ (r'\[', Comment, '#push'), (r'\]', Comment, '#pop'), (r'"', Comment, "commentString1"), - (r'{', Comment, "commentString2"), + (r'\{', Comment, "commentString2"), (r'[^(\[\]\"{)]+', Comment), ], } @@ -325,13 +325,13 @@ class RedLexer(RegexLexer): 'script': [ (r'\s+', Text), (r'#"', String.Char, 'char'), - (r'#{[0-9a-f\s]*}', Number.Hex), - (r'2#{', Number.Hex, 'bin2'), - (r'64#{[0-9a-z+/=\s]*}', Number.Hex), + (r'#\{[0-9a-f\s]*\}', Number.Hex), + (r'2#\{', Number.Hex, 'bin2'), + (r'64#\{[0-9a-z+/=\s]*\}', Number.Hex), (r'([0-9a-f]+)(h)((\s)|(?=[\[\]{}""\(\)]))', bygroups(Number.Hex, Name.Variable, Whitespace)), (r'"', String, 'string'), - (r'{', String, 'string2'), + (r'\{', String, 'string2'), (r';#+.*\n', Comment.Special), (r';\*+.*\n', Comment.Preproc), (r';.*\n', Comment), @@ -351,7 +351,7 @@ class RedLexer(RegexLexer): (r'mailto:[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # url (r'[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # email (r'comment\s"', Comment, 'commentString1'), - (r'comment\s{', Comment, 'commentString2'), + (r'comment\s\{', Comment, 'commentString2'), (r'comment\s\[', Comment, 'commentBlock'), (r'comment\s[^(\s{\"\[]+', Comment), (r'/[^(\^{^")\s/[\]]*', Name.Attribute), @@ -372,8 +372,8 @@ class RedLexer(RegexLexer): (escape_re, String.Escape), (r'[\(|\)]+', String), (r'\^.', String.Escape), - (r'{', String, '#push'), - (r'}', String, '#pop'), + (r'\{', String, '#push'), + (r'\}', String, '#pop'), ], 'stringFile': [ (r'[^(\^")]+', Name.Decorator), @@ -406,7 +406,7 @@ class RedLexer(RegexLexer): 'bin2': [ (r'\s+', Number.Hex), (r'([0-1]\s*){8}', Number.Hex), - (r'}', Number.Hex, '#pop'), + (r'\}', Number.Hex, '#pop'), ], 'commentString1': [ (r'[^(\^")]+', Comment), @@ -420,14 +420,14 @@ class RedLexer(RegexLexer): (escape_re, Comment), (r'[\(|\)]+', Comment), (r'\^.', Comment), - (r'{', Comment, '#push'), - (r'}', Comment, '#pop'), + (r'\{', Comment, '#push'), + (r'\}', Comment, '#pop'), ], 'commentBlock': [ (r'\[', Comment, '#push'), (r'\]', Comment, '#pop'), (r'"', Comment, "commentString1"), - (r'{', Comment, "commentString2"), + (r'\{', Comment, "commentString2"), (r'[^(\[\]\"{)]+', Comment), ], } 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) ] } diff --git a/pygments/lexers/ruby.py b/pygments/lexers/ruby.py index 096c6dc8..2becb101 100644 --- a/pygments/lexers/ruby.py +++ b/pygments/lexers/ruby.py @@ -342,12 +342,12 @@ class RubyLexer(ExtendedRegexLexer): include('root') ], 'in-intp': [ - (r'{', String.Interpol, '#push'), - (r'}', String.Interpol, '#pop'), + (r'\{', String.Interpol, '#push'), + (r'\}', String.Interpol, '#pop'), include('root'), ], 'string-intp': [ - (r'#{', String.Interpol, 'in-intp'), + (r'#\{', String.Interpol, 'in-intp'), (r'#@@?[a-zA-Z_]\w*', String.Interpol), (r'#\$[a-zA-Z_]\w*', String.Interpol) ], diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py index b4d81446..3973afa5 100644 --- a/pygments/lexers/shell.py +++ b/pygments/lexers/shell.py @@ -87,7 +87,7 @@ class BashLexer(RegexLexer): include('interp'), ], 'curly': [ - (r'}', String.Interpol, '#pop'), + (r'\}', String.Interpol, '#pop'), (r':-', Keyword), (r'\w+', Name.Variable), (r'[^}:"\'`$\\]+', Punctuation), @@ -322,7 +322,7 @@ class TcshLexer(RegexLexer): (r'\$#?(\w+|.)', Name.Variable), ], 'curly': [ - (r'}', Keyword, '#pop'), + (r'\}', Keyword, '#pop'), (r':-', Keyword), (r'\w+', Name.Variable), (r'[^}:"\'`$]+', Punctuation), diff --git a/pygments/lexers/tcl.py b/pygments/lexers/tcl.py index 13d945d7..b4c4cc89 100644 --- a/pygments/lexers/tcl.py +++ b/pygments/lexers/tcl.py @@ -59,7 +59,7 @@ class TclLexer(RegexLexer): include('command'), include('basic'), include('data'), - (r'}', Keyword), # HACK: somehow we miscounted our braces + (r'\}', Keyword), # HACK: somehow we miscounted our braces ], 'command': _gen_command_rules(keyword_cmds_re, builtin_cmds_re), 'command-in-brace': _gen_command_rules(keyword_cmds_re, @@ -96,7 +96,7 @@ class TclLexer(RegexLexer): include('data'), ], 'params-in-brace': [ - (r'}', Keyword, ('#pop', '#pop')), + (r'\}', Keyword, ('#pop', '#pop')), include('params') ], 'params-in-paren': [ @@ -118,7 +118,7 @@ class TclLexer(RegexLexer): (r'\]', String.Double, '#pop') ], 'brace': [ - (r'}', Keyword, '#pop'), + (r'\}', Keyword, '#pop'), include('command-in-brace'), include('basic'), include('data'), diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index 171741ac..e7a2e567 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -171,8 +171,8 @@ class SmartyLexer(RegexLexer): ], 'smarty': [ (r'\s+', Text), - (r'{', Comment.Preproc, '#push'), - (r'}', Comment.Preproc, '#pop'), + (r'\{', Comment.Preproc, '#push'), + (r'\}', Comment.Preproc, '#pop'), (r'#[a-zA-Z_]\w*#', Name.Variable), (r'\$[a-zA-Z_]\w*(\.\w+)*', Name.Variable), (r'[~!%^&*()+=|\[\]:;,.<>/?@-]', Operator), @@ -1890,7 +1890,7 @@ class LiquidLexer(RegexLexer): (r'({{)(\s*)([^\s}]+)', bygroups(Punctuation, Whitespace, using(this, state = 'generic')), 'output'), - (r'{', Text) + (r'\{', Text) ], 'tag-or-block': [ diff --git a/pygments/lexers/theorem.py b/pygments/lexers/theorem.py index ba942dbf..137355f1 100644 --- a/pygments/lexers/theorem.py +++ b/pygments/lexers/theorem.py @@ -85,8 +85,8 @@ class CoqLexer(RegexLexer): keyopts = ( '!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-', r'-\.', '->', r'\.', r'\.\.', ':', '::', ':=', ':>', ';', ';;', '<', '<-', - '<->', '=', '>', '>]', '>}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>', - r'\[\|', ']', '_', '`', '{', '{<', r'\|', r'\|]', '}', '~', '=>', + '<->', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>', + r'\[\|', ']', '_', '`', r'\{', r'\{<', r'\|', r'\|]', r'\}', '~', '=>', r'/\\', r'\\/', u'Π', u'λ', ) diff --git a/pygments/lexers/webmisc.py b/pygments/lexers/webmisc.py index fe0fae64..2f3707f6 100644 --- a/pygments/lexers/webmisc.py +++ b/pygments/lexers/webmisc.py @@ -444,7 +444,7 @@ class XQueryLexer(ExtendedRegexLexer): ], 'kindtest': [ (r'\(:', Comment, 'comment'), - (r'{', Punctuation, 'root'), + (r'\{', Punctuation, 'root'), (r'(\))([*+?]?)', popstate_kindtest_callback), (r'\*', Name, 'closekindtest'), (qname, Name, 'closekindtest'), |