diff options
author | Tim Hatch <tim@timhatch.com> | 2014-05-16 14:20:32 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-05-16 14:20:32 -0700 |
commit | 6c1b71840afd3abc6577452ed47c813290245491 (patch) | |
tree | d581a50109fca8122e92ed6dcfb63b5834462b07 /pygments | |
parent | d961cec379aa5bba2102af3627002968aa2d0173 (diff) | |
parent | 45c6a7514c20a476ac20d5dd6979524b3c5232ea (diff) | |
download | pygments-6c1b71840afd3abc6577452ed47c813290245491.tar.gz |
Merged in jaingaurav2/pygments-main (pull request #357)
Numerous regexlint fixes
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/lexers/agile.py | 4 | ||||
-rw-r--r-- | pygments/lexers/asm.py | 4 | ||||
-rw-r--r-- | pygments/lexers/compiled.py | 32 | ||||
-rw-r--r-- | pygments/lexers/dotnet.py | 10 | ||||
-rw-r--r-- | pygments/lexers/functional.py | 8 | ||||
-rw-r--r-- | pygments/lexers/hdl.py | 20 | ||||
-rw-r--r-- | pygments/lexers/jvm.py | 2 | ||||
-rw-r--r-- | pygments/lexers/math.py | 16 | ||||
-rw-r--r-- | pygments/lexers/other.py | 64 | ||||
-rw-r--r-- | pygments/lexers/parsers.py | 4 | ||||
-rw-r--r-- | pygments/lexers/shell.py | 8 | ||||
-rw-r--r-- | pygments/lexers/sql.py | 22 | ||||
-rw-r--r-- | pygments/lexers/templates.py | 6 | ||||
-rw-r--r-- | pygments/lexers/text.py | 6 | ||||
-rw-r--r-- | pygments/lexers/web.py | 56 |
15 files changed, 132 insertions, 130 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index a0cd63cf..cd105126 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -972,8 +972,8 @@ class PerlLexer(RegexLexer): 'name': [ (r'\w+::', Name.Namespace), (r'[\w:]+', Name, '#pop'), - (r'[A-Z_]+(?=[^\w])', Name.Constant, '#pop'), - (r'(?=[^\w])', Text, '#pop'), + (r'[A-Z_]+(?=\W)', Name.Constant, '#pop'), + (r'(?=\W)', Text, '#pop'), ], 'modulename': [ (r'[a-zA-Z_]\w*', Name.Namespace, '#pop') diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py index 13649521..35092f52 100644 --- a/pygments/lexers/asm.py +++ b/pygments/lexers/asm.py @@ -318,8 +318,8 @@ class NasmLexer(RegexLexer): filenames = ['*.asm', '*.ASM'] mimetypes = ['text/x-nasm'] - identifier = r'[a-zA-Z$._?][\w$.?#@~]*' - hexn = r'(?:0[xX][0-9a-fA-F]+|$0[0-9a-fA-F]*|[0-9]+[0-9a-fA-F]*h)' + identifier = r'[a-z$._?][\w$.?#@~]*' + hexn = r'(?:0[xX][0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)' octn = r'[0-7]+q' binn = r'[01]+b' decn = r'[0-9]+' diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 913de08b..ec3015a5 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -1158,7 +1158,7 @@ class DylanLexer(RegexLexer): 'type-error-value', 'type-for-copy', 'type-union', 'union', 'values', 'vector', 'zero?']) - valid_name = '\\\\?[a-zA-Z0-9' + re.escape('!&*<>|^$%@_-+~?/=') + ']+' + valid_name = '\\\\?[a-z0-9' + re.escape('!&*<>|^$%@_-+~?/=') + ']+' def get_tokens_unprocessed(self, text): for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): @@ -1187,7 +1187,7 @@ class DylanLexer(RegexLexer): (r'//.*?\n', Comment.Single), # lid header - (r'([A-Za-z0-9-]+)(:)([ \t]*)(.*(?:\n[ \t].+)*)', + (r'([a-z0-9-]+)(:)([ \t]*)(.*(?:\n[ \t].+)*)', bygroups(Name.Attribute, Operator, Text, String)), ('', Text, 'code') # no header match, switch to code @@ -1204,7 +1204,7 @@ class DylanLexer(RegexLexer): # strings and characters (r'"', String, 'string'), - (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), + (r"'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\'\n])'", String.Char), # binary integer (r'#[bB][01]+', Number), @@ -1219,7 +1219,7 @@ class DylanLexer(RegexLexer): (r'[-+]?\d+', Number.Integer), # hex integer - (r'#[xX][0-9a-fA-F]+', Number.Hex), + (r'#[xX][0-9a-f]+', Number.Hex), # Macro parameters (r'(\?' + valid_name + ')(:)' @@ -1243,7 +1243,7 @@ class DylanLexer(RegexLexer): (r'#"', String.Symbol, 'keyword'), # #rest, #key, #all-keys, etc. - (r'#[a-zA-Z0-9-]+', Keyword), + (r'#[a-z0-9-]+', Keyword), # required-init-keyword: style keywords. (valid_name + ':', Keyword), @@ -1272,7 +1272,7 @@ class DylanLexer(RegexLexer): ], 'string': [ (r'"', String, '#pop'), - (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'\\([\\abfnrtv"\']|x[a-f0-9]{2,4}|[0-7]{1,3})', String.Escape), (r'[^\\"\n]+', String), # all other characters (r'\\\n', String), # line continuation (r'\\', String), # stray backslash @@ -1573,7 +1573,7 @@ class FortranLexer(RegexLexer): (r'!.*\n', Comment), include('strings'), include('core'), - (r'[a-z][a-z0-9_]*', Name.Variable), + (r'[a-z]\w*', Name.Variable), include('nums'), (r'[\s]+', Text), ], @@ -1657,9 +1657,9 @@ class FortranLexer(RegexLexer): ], 'nums': [ - (r'\d+(?![.Ee])(_[a-z][a-z0-9_]+)?', Number.Integer), - (r'[+-]?\d*\.\d+([eE][-+]?\d+)?(_[a-z][a-z0-9_]+)?', Number.Float), - (r'[+-]?\d+\.\d*([eE][-+]?\d+)?(_[a-z][a-z0-9_]+)?', Number.Float), + (r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer), + (r'[+-]?\d*\.\d+(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float), + (r'[+-]?\d+\.\d*(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float), ], } @@ -2764,9 +2764,9 @@ class BlitzMaxLexer(RegexLexer): bmax_vopwords = r'\b(Shl|Shr|Sar|Mod)\b' bmax_sktypes = r'@{1,2}|[!#$%]' bmax_lktypes = r'\b(Int|Byte|Short|Float|Double|Long)\b' - bmax_name = r'[a-z_][a-z0-9_]*' + bmax_name = r'[a-z_]\w*' bmax_var = (r'(%s)(?:(?:([ \t]*)(%s)|([ \t]*:[ \t]*\b(?:Shl|Shr|Sar|Mod)\b)' - r'|([ \t]*)([:])([ \t]*)(?:%s|(%s)))(?:([ \t]*)(Ptr))?)') % \ + r'|([ \t]*)(:)([ \t]*)(?:%s|(%s)))(?:([ \t]*)(Ptr))?)') % \ (bmax_name, bmax_sktypes, bmax_lktypes, bmax_name) bmax_func = bmax_var + r'?((?:[ \t]|\.\.\n)*)([(])' @@ -2859,7 +2859,7 @@ class BlitzBasicLexer(RegexLexer): r'Abs|Sgn|Handle|Int|Float|Str|' r'First|Last|Before|After)\b') bb_sktypes = r'@{1,2}|[#$%]' - bb_name = r'[a-z][a-z0-9_]*' + bb_name = r'[a-z]\w*' bb_var = (r'(%s)(?:([ \t]*)(%s)|([ \t]*)([.])([ \t]*)(?:(%s)))?') % \ (bb_name, bb_sktypes, bb_name) @@ -3004,7 +3004,7 @@ class NimrodLexer(RegexLexer): # Numbers (r'[0-9][0-9_]*(?=([eE.]|\'[fF](32|64)))', Number.Float, ('float-suffix', 'float-number')), - (r'0[xX][a-fA-F0-9][a-fA-F0-9_]*', Number.Hex, 'int-suffix'), + (r'0[xX][a-f0-9][a-f0-9_]*', Number.Hex, 'int-suffix'), (r'0[bB][01][01_]*', Number, 'int-suffix'), (r'0o[0-7][0-7_]*', Number.Oct, 'int-suffix'), (r'[0-9][0-9_]*', Number.Integer, 'int-suffix'), @@ -3013,7 +3013,7 @@ class NimrodLexer(RegexLexer): (r'.+$', Error), ], 'chars': [ - (r'\\([\\abcefnrtvl"\']|x[a-fA-F0-9]{2}|[0-9]{1,3})', String.Escape), + (r'\\([\\abcefnrtvl"\']|x[a-f0-9]{2}|[0-9]{1,3})', String.Escape), (r"'", String.Char, '#pop'), (r".", String.Char) ], @@ -3027,7 +3027,7 @@ class NimrodLexer(RegexLexer): # newlines are an error (use "nl" state) ], 'dqs': [ - (r'\\([\\abcefnrtvl"\']|\n|x[a-fA-F0-9]{2}|[0-9]{1,3})', + (r'\\([\\abcefnrtvl"\']|\n|x[a-f0-9]{2}|[0-9]{1,3})', String.Escape), (r'"', String, '#pop'), include('strings') diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py index bfb42f97..5a07cd0d 100644 --- a/pygments/lexers/dotnet.py +++ b/pygments/lexers/dotnet.py @@ -425,7 +425,7 @@ class VbNetLexer(RegexLexer): r'<=|>=|<>|[-&*/\\^+=<>]', Operator), ('"', String, 'string'), - ('[a-zA-Z_]\w*[%&@!#$]?', Name), + ('[a-z_]\w*[%&@!#$]?', Name), ('#.*?#', Literal.Date), (r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float), (r'\d+([SILDFR]|US|UI|UL)?', Number.Integer), @@ -439,17 +439,17 @@ class VbNetLexer(RegexLexer): (r'[^"]+', String), ], 'dim': [ - (r'[a-z_][a-z0-9_]*', Name.Variable, '#pop'), + (r'[a-z_]\w*', Name.Variable, '#pop'), (r'', Text, '#pop'), # any other syntax ], 'funcname': [ - (r'[a-z_][a-z0-9_]*', Name.Function, '#pop'), + (r'[a-z_]\w*', Name.Function, '#pop'), ], 'classname': [ - (r'[a-z_][a-z0-9_]*', Name.Class, '#pop'), + (r'[a-z_]\w*', Name.Class, '#pop'), ], 'namespace': [ - (r'[a-z_][a-z0-9_.]*', Name.Namespace, '#pop'), + (r'[a-z_][\w.]*', Name.Namespace, '#pop'), ], 'end': [ (r'\s+', Text), diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index f15b268e..6d808f7e 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -851,10 +851,10 @@ class CommonLispLexer(RegexLexer): (r'#[oO][+-]?[0-7]+(/[0-7]+)?', Number.Oct), # hex rational - (r'#[xX][+-]?[0-9a-fA-F]+(/[0-9a-fA-F]+)?', Number.Hex), + (r'#[xX][+-]?[0-9a-f]+(/[0-9a-f]+)?', Number.Hex), # radix rational - (r'#\d+[rR][+-]?[0-9a-zA-Z]+(/[0-9a-zA-Z]+)?', Number), + (r'#\d+[rR][+-]?[0-9a-z]+(/[0-9a-z]+)?', Number), # complex (r'(#[cC])(\()', bygroups(Number, Punctuation), 'body'), @@ -1166,7 +1166,7 @@ class AgdaLexer(RegexLexer): (r'\b(Set|Prop)\b', Keyword.Type), # Special Symbols (r'(\(|\)|\{|\})', Operator), - (u'(\\.{1,3}|\\||[\u039B]|[\u2200]|[\u2192]|:|=|->)', Operator.Word), + (u'(\\.{1,3}|\\||\u039B|\u2200|\u2192|:|=|->)', Operator.Word), # Numbers (r'\d+[eE][+-]?\d+', Number.Float), (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), @@ -2682,7 +2682,7 @@ class ElixirLexer(RegexLexer): (r':"', String.Symbol, 'interpoling_symbol'), (r'\b(nil|true|false)\b(?![?!])|\b[A-Z]\w*\b', Name.Constant), (r'\b(__(FILE|LINE|MODULE|MAIN|FUNCTION)__)\b(?![?!])', Name.Builtin.Pseudo), - (r'[a-zA-Z_!][\w_]*[!\?]?', Name), + (r'[a-zA-Z_!]\w*[!\?]?', Name), (r'[(){};,/\|:\\\[\]]', Punctuation), (r'@[a-zA-Z_]\w*|&\d', Name.Variable), (r'\b(0[xX][0-9A-Fa-f]+|\d(_?\d)*(\.(?![^\d\s])' diff --git a/pygments/lexers/hdl.py b/pygments/lexers/hdl.py index 55eec252..6240cfe0 100644 --- a/pygments/lexers/hdl.py +++ b/pygments/lexers/hdl.py @@ -290,19 +290,19 @@ class VhdlLexer(RegexLexer): (r'--(?![!#$%&*+./<=>?@\^|_~]).*?$', Comment.Single), (r"'(U|X|0|1|Z|W|L|H|-)'", String.Char), (r'[~!%^&*+=|?:<>/-]', Operator), - (r"'[a-zA-Z_]\w*", Name.Attribute), + (r"'[a-z_]\w*", Name.Attribute), (r'[()\[\],.;\']', Punctuation), (r'"[^\n\\]*"', String), - (r'(library)(\s+)([a-zA-Z_]\w*)', + (r'(library)(\s+)([a-z_]\w*)', bygroups(Keyword, Text, Name.Namespace)), (r'(use)(\s+)(entity)', bygroups(Keyword, Text, Keyword)), - (r'(use)(\s+)([a-zA-Z_][\.\w]*)', + (r'(use)(\s+)([a-z_][\.\w]*)', bygroups(Keyword, Text, Name.Namespace)), - (r'(entity|component)(\s+)([a-zA-Z_]\w*)', + (r'(entity|component)(\s+)([a-z_]\w*)', bygroups(Keyword, Text, Name.Class)), - (r'(architecture|configuration)(\s+)([a-zA-Z_]\w*)(\s+)' - r'(of)(\s+)([a-zA-Z_]\w*)(\s+)(is)', + (r'(architecture|configuration)(\s+)([a-z_]\w*)(\s+)' + r'(of)(\s+)([a-z_]\w*)(\s+)(is)', bygroups(Keyword, Text, Name.Class, Text, Keyword, Text, Name.Class, Text, Keyword)), @@ -312,11 +312,11 @@ class VhdlLexer(RegexLexer): include('keywords'), include('numbers'), - (r'[a-zA-Z_]\w*', Name), + (r'[a-z_]\w*', Name), ], 'endblock': [ include('keywords'), - (r'[a-zA-Z_]\w*', Name.Class), + (r'[a-z_]\w*', Name.Class), (r'(\s+)', Text), (r';', Punctuation, '#pop'), ], @@ -345,11 +345,11 @@ class VhdlLexer(RegexLexer): r'while|with|xnor|xor)\b', Keyword), ], 'numbers': [ - (r'\d{1,2}#[0-9a-fA-F_]+#?', Number.Integer), + (r'\d{1,2}#[0-9a-f_]+#?', Number.Integer), (r'[0-1_]+(\.[0-1_])', Number.Integer), (r'\d+', Number.Integer), (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float), - (r'H"[0-9a-fA-F_]+"', Number.Oct), + (r'H"[0-9a-f_]+"', Number.Oct), (r'O"[0-7_]+"', Number.Oct), (r'B"[0-1_]+"', Number.Oct), ], diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index d192ffcc..69d90b78 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -1112,7 +1112,7 @@ class PigLexer(RegexLexer): (r'0x[0-9a-f]+', Number.Hex), (r'[0-9]+L?', Number.Integer), (r'\n', Text), - (r'([a-z_][a-z0-9_]*)(\s*)(\()', + (r'([a-z_]\w*)(\s*)(\()', bygroups(Name.Function, Text, Punctuation)), (r'[()#:]', Text), (r'[^(:#\'\")\s]+', Text), diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py index cd98a755..19bcd8e8 100644 --- a/pygments/lexers/math.py +++ b/pygments/lexers/math.py @@ -1656,6 +1656,8 @@ class IDLLexer(RegexLexer): filenames = ['*.pro'] mimetypes = ['text/idl'] + flags = re.IGNORECASE | re.MULTILINE + _RESERVED = ['and', 'begin', 'break', 'case', 'common', 'compile_opt', 'continue', 'do', 'else', 'end', 'endcase', 'elseelse', 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch', @@ -1677,7 +1679,7 @@ class IDLLexer(RegexLexer): 'broyden', 'butterworth', 'bytarr', 'byte', 'byteorder', 'bytscl', 'caldat', 'calendar', 'call_external', 'call_function', 'call_method', 'call_procedure', 'canny', - 'catch', 'cd', 'cdf_[0-9a-za-z_]*', 'ceil', 'chebyshev', + 'catch', 'cd', 'cdf_\w*', 'ceil', 'chebyshev', 'check_math', 'chisqr_cvf', 'chisqr_pdf', 'choldc', 'cholsol', 'cindgen', 'cir_3pnt', 'close', 'cluster', 'cluster_tree', 'clust_wts', @@ -1711,7 +1713,7 @@ class IDLLexer(RegexLexer): 'dlm_load', 'dlm_register', 'doc_library', 'double', 'draw_roi', 'edge_dog', 'efont', 'eigenql', 'eigenvec', 'ellipse', 'elmhes', 'emboss', 'empty', 'enable_sysrtn', - 'eof', 'eos_[0-9a-za-z_]*', 'erase', 'erf', 'erfc', 'erfcx', + 'eof', 'eos_\w*', 'erase', 'erf', 'erfc', 'erfcx', 'erode', 'errorplot', 'errplot', 'estimator_filter', 'execute', 'exit', 'exp', 'expand', 'expand_path', 'expint', 'extrac', 'extract_slice', 'factorial', 'fft', 'filepath', @@ -1728,11 +1730,11 @@ class IDLLexer(RegexLexer): 'gauss_cvf', 'gauss_pdf', 'gauss_smooth', 'getenv', 'getwindows', 'get_drive_list', 'get_dxf_objects', 'get_kbrd', 'get_login_info', 'get_lun', 'get_screen_size', - 'greg2jul', 'grib_[0-9a-za-z_]*', 'grid3', 'griddata', + 'greg2jul', 'grib_\w*', 'grid3', 'griddata', 'grid_input', 'grid_tps', 'gs_iter', - 'h5[adfgirst]_[0-9a-za-z_]*', 'h5_browser', 'h5_close', + 'h5[adfgirst]_\w*', 'h5_browser', 'h5_close', 'h5_create', 'h5_get_libversion', 'h5_open', 'h5_parse', - 'hanning', 'hash', 'hdf_[0-9a-za-z_]*', 'heap_free', + 'hanning', 'hash', 'hdf_\w*', 'heap_free', 'heap_gc', 'heap_nosave', 'heap_refcount', 'heap_save', 'help', 'hilbert', 'histogram', 'hist_2d', 'hist_equal', 'hls', 'hough', 'hqr', 'hsv', 'h_eq_ct', 'h_eq_int', @@ -1780,7 +1782,7 @@ class IDLLexer(RegexLexer): 'modifyct', 'moment', 'morph_close', 'morph_distance', 'morph_gradient', 'morph_hitormiss', 'morph_open', 'morph_thin', 'morph_tophat', 'multi', 'm_correlate', - 'ncdf_[0-9a-za-z_]*', 'newton', 'noise_hurl', 'noise_pick', + 'ncdf_\w*', 'newton', 'noise_hurl', 'noise_pick', 'noise_scatter', 'noise_slur', 'norm', 'n_elements', 'n_params', 'n_tags', 'objarr', 'obj_class', 'obj_destroy', 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid', @@ -2182,7 +2184,7 @@ class IgorLexer(RegexLexer): # Compiler directives. (r'^#(include|pragma|define|ifdef|ifndef|endif)', Name.Decorator), - (r'[^a-zA-Z"/]+$', Text), + (r'[^a-z"/]+$', Text), (r'.', Text), ], } diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index cef71f95..42d02301 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -156,15 +156,15 @@ class ECLLexer(RegexLexer): include('hash'), (r'"', String, 'string'), (r'\'', String, 'string'), - (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+)e[+-]?\d+[lu]*', Number.Float), (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), - (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex), - (r'0[0-7]+[LlUu]*', Number.Oct), + (r'0x[0-9a-f]+[lu]*', Number.Hex), + (r'0[0-7]+[lu]*', Number.Oct), (r'\d+[LlUu]*', Number.Integer), (r'\*/', Error), (r'[~!%^&*+=|?:<>/-]+', Operator), (r'[{}()\[\],.;]', Punctuation), - (r'[a-zA-Z_]\w*', Name), + (r'[a-z_]\w*', Name), ], 'hash': [ (r'^#.*$', Comment.Preproc), @@ -1306,9 +1306,9 @@ class ModelicaLexer(RegexLexer): (r'\d+[Ll]?', Number.Integer), (r'[~!%^&*+=|?:<>/-]', Operator), (r'(true|false|NULL|Real|Integer|Boolean)\b', Name.Builtin), - (r'([a-zA-Z_][\w]*|[\'][^\']+[\'])' + (r'([a-z_][\w]*|\'[^\']+\')' r'([\[\d,:\]]*)' - r'(\.([a-zA-Z_][\w]*|[\'][^\']+[\']))+' + r'(\.([a-z_][\w]*|\'[^\']+\'))+' r'([\[\d,:\]]*)', Name.Class), (r'(\'[\w\+\-\*\/\^]+\'|\w+)', Name), (r'[()\[\]{},.;]', Punctuation), @@ -1350,7 +1350,7 @@ class ModelicaLexer(RegexLexer): 'classes': [ (r'(operator)?(\s+)?(block|class|connector|end|function|model|' r'operator|package|record|type)(\s+)' - r'((?!if|for|when|while)[A-Za-z_]\w*|[\'][^\']+[\'])([;]?)', + r'((?!if|for|when|while)[a-z_]\w*|\'[^\']+\')([;]?)', bygroups(Keyword, Text, Keyword, Text, Name.Class, Text)) ], 'quoted_ident': [ @@ -1359,7 +1359,7 @@ class ModelicaLexer(RegexLexer): ], 'string': [ (r'"', String, '#pop'), - (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', + (r'\\([\\abfnrtv"\']|x[a-f0-9]{2,4}|[0-7]{1,3})', String.Escape), (r'[^\\"\n]+', String), # all other characters (r'\\\n', String), # line continuation @@ -1387,7 +1387,7 @@ class RebolLexer(RegexLexer): re.IGNORECASE - escape_re = r'(?:\^\([0-9a-fA-F]{1,4}\)*)' + escape_re = r'(?:\^\([0-9a-f]{1,4}\)*)' def word_callback(lexer, match): word = match.group() @@ -1483,9 +1483,9 @@ class RebolLexer(RegexLexer): 'script': [ (r'\s+', Text), (r'#"', String.Char, 'char'), - (r'#{[0-9a-fA-F]*}', Number.Hex), + (r'#{[0-9a-f]*}', Number.Hex), (r'2#{', Number.Hex, 'bin2'), - (r'64#{[0-9a-zA-Z+/=\s]*}', Number.Hex), + (r'64#{[0-9a-z+/=\s]*}', Number.Hex), (r'"', String, 'string'), (r'{', String, 'string2'), (r';#+.*\n', Comment.Special), @@ -1493,9 +1493,9 @@ class RebolLexer(RegexLexer): (r';.*\n', Comment), (r'%"', Name.Decorator, 'stringFile'), (r'%[^(\^{^")\s\[\]]+', Name.Decorator), - (r'[+-]?([a-zA-Z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money + (r'[+-]?([a-z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money (r'[+-]?\d+\:\d+(\:\d+)?(\.\d+)?', String.Other), # time - (r'\d+[\-\/][0-9a-zA-Z]+[\-\/]\d+(\/\d+\:\d+((\:\d+)?' + (r'\d+[\-\/][0-9a-z]+[\-\/]\d+(\/\d+\:\d+((\:\d+)?' r'([\.\d+]?([+-]?\d+:\d+)?)?)?)?', String.Other), # date (r'\d+(\.\d+)+\.\d+', Keyword.Constant), # tuple (r'\d+[xX]\d+', Keyword.Constant), # pair @@ -1503,7 +1503,7 @@ class RebolLexer(RegexLexer): (r'[+-]?\d+(\'\d+)?[\.,]\d*', Number.Float), (r'[+-]?\d+(\'\d+)?', Number), (r'[\[\]\(\)]', Generic.Strong), - (r'[a-zA-Z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url + (r'[a-z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url (r'mailto:[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # url (r'[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # email (r'comment\s"', Comment, 'commentString1'), @@ -1512,7 +1512,7 @@ class RebolLexer(RegexLexer): (r'comment\s[^(\s{\"\[]+', Comment), (r'/[^(\^{^")\s/[\]]*', Name.Attribute), (r'([^(\^{^")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback), - (r'<[a-zA-Z0-9:._-]*>', Name.Tag), + (r'<[\w:.-]*>', Name.Tag), (r'<[^(<>\s")]+', Name.Tag, 'tag'), (r'([^(\^{^")\s]+)', Text), ], @@ -1619,7 +1619,7 @@ class ABAPLexer(RegexLexer): (r'\".*?\n', Comment.Single), ], 'variable-names': [ - (r'<[\S_]+>', Name.Variable), + (r'<\S+>', Name.Variable), (r'\w[\w~]*(?:(\[\])|->\*)?', Name.Variable), ], 'root': [ @@ -2393,7 +2393,7 @@ class MaqlLexer(RegexLexer): r'SYNCHRONIZE|TYPE|DEFAULT|ORDER|ASC|DESC|HYPERLINK|' r'INCLUDE|TEMPLATE|MODIFY)\b', Keyword), # FUNCNAME - (r'[a-zA-Z]\w*\b', Name.Function), + (r'[a-z]\w*\b', Name.Function), # Comments (r'#.*', Comment.Single), # Punctuation @@ -2428,7 +2428,7 @@ class GoodDataCLLexer(RegexLexer): # Comments (r'#.*', Comment.Single), # Function call - (r'[a-zA-Z]\w*', Name.Function), + (r'[a-z]\w*', Name.Function), # Argument list (r'\(', Token.Punctuation, 'args-list'), # Punctuation @@ -2439,7 +2439,7 @@ class GoodDataCLLexer(RegexLexer): 'args-list': [ (r'\)', Token.Punctuation, '#pop'), (r',', Token.Punctuation), - (r'[a-zA-Z]\w*', Name.Variable), + (r'[a-z]\w*', Name.Variable), (r'=', Operator), (r'"', Literal.String, 'string-literal'), (r'[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]{1,3})?', Literal.Number), @@ -3202,9 +3202,9 @@ class VGLLexer(RegexLexer): (r'(true|false|null|empty|error|locked)', Keyword.Constant), (r'[~\^\*\#!%&\[\]\(\)<>\|+=:;,./?-]', Operator), (r'"[^"]*"', String), - (r'(\.)([a-z_\$][a-z0-9_\$]*)', bygroups(Operator, Name.Attribute)), + (r'(\.)([a-z_\$][\w\$]*)', bygroups(Operator, Name.Attribute)), (r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number), - (r'[a-z_\$][a-z0-9_\$]*', Name), + (r'[a-z_\$][\w\$]*', Name), (r'[\r\n]+', Text), (r'\s+', Text) ] @@ -3800,15 +3800,15 @@ class RexxLexer(RegexLexer): (r'"', String, 'string_double'), (r"'", String, 'string_single'), (r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number), - (r'([a-z_][a-z0-9_]*)(\s*)(:)(\s*)(procedure)\b', + (r'([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b', bygroups(Name.Function, Whitespace, Operator, Whitespace, Keyword.Declaration)), - (r'([a-z_][a-z0-9_]*)(\s*)(:)', + (r'([a-z_]\w*)(\s*)(:)', bygroups(Name.Label, Whitespace, Operator)), include('function'), include('keyword'), include('operator'), - (r'[a-z_][a-z0-9_]*', Text), + (r'[a-z_]\w*', Text), ], 'function': [ (r'(abbrev|abs|address|arg|b2x|bitand|bitor|bitxor|c2d|c2x|' @@ -3856,7 +3856,7 @@ class RexxLexer(RegexLexer): _ADDRESS_PATTERN = _c(r'^\s*address\s+') _DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b') _IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$') - _PROCEDURE_PATTERN = _c(r'^\s*([a-z_][a-z0-9_]*)(\s*)(:)(\s*)(procedure)\b') + _PROCEDURE_PATTERN = _c(r'^\s*([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b') _ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$') _PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b') PATTERNS_AND_WEIGHTS = ( @@ -4255,7 +4255,7 @@ class RedLexer(RegexLexer): flags = re.IGNORECASE | re.MULTILINE - escape_re = r'(?:\^\([0-9a-fA-F]{1,4}\)*)' + escape_re = r'(?:\^\([0-9a-f]{1,4}\)*)' def word_callback(lexer, match): word = match.group() @@ -4326,10 +4326,10 @@ class RedLexer(RegexLexer): 'script': [ (r'\s+', Text), (r'#"', String.Char, 'char'), - (r'#{[0-9a-fA-F\s]*}', Number.Hex), + (r'#{[0-9a-f\s]*}', Number.Hex), (r'2#{', Number.Hex, 'bin2'), - (r'64#{[0-9a-zA-Z+/=\s]*}', Number.Hex), - (r'([0-9a-fA-F]+)(h)((\s)|(?=[\[\]{}""\(\)]))', + (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'), @@ -4338,9 +4338,9 @@ class RedLexer(RegexLexer): (r';.*\n', Comment), (r'%"', Name.Decorator, 'stringFile'), (r'%[^(\^{^")\s\[\]]+', Name.Decorator), - (r'[+-]?([a-zA-Z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money + (r'[+-]?([a-z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money (r'[+-]?\d+\:\d+(\:\d+)?(\.\d+)?', String.Other), # time - (r'\d+[\-\/][0-9a-zA-Z]+[\-\/]\d+(\/\d+\:\d+((\:\d+)?' + (r'\d+[\-\/][0-9a-z]+[\-\/]\d+(\/\d+\:\d+((\:\d+)?' r'([\.\d+]?([+-]?\d+:\d+)?)?)?)?', String.Other), # date (r'\d+(\.\d+)+\.\d+', Keyword.Constant), # tuple (r'\d+[xX]\d+', Keyword.Constant), # pair @@ -4348,7 +4348,7 @@ class RedLexer(RegexLexer): (r'[+-]?\d+(\'\d+)?[\.,]\d*', Number.Float), (r'[+-]?\d+(\'\d+)?', Number), (r'[\[\]\(\)]', Generic.Strong), - (r'[a-zA-Z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url + (r'[a-z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url (r'mailto:[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # url (r'[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # email (r'comment\s"', Comment, 'commentString1'), diff --git a/pygments/lexers/parsers.py b/pygments/lexers/parsers.py index fc8cbb6f..4c23c760 100644 --- a/pygments/lexers/parsers.py +++ b/pygments/lexers/parsers.py @@ -102,7 +102,7 @@ class RagelLexer(RegexLexer): 'host': [ (r'(' + r'|'.join(( # keep host code in largest possible chunks r'[^{}\'"/#]+', # exclude unsafe characters - r'[^\\][\\][{}]', # allow escaped { or } + r'[^\\]\\[{}]', # allow escaped { or } # strings and comments may safely contain unsafe characters r'"(\\\\|\\"|[^"])*"', # double quote string @@ -173,7 +173,7 @@ class RagelEmbeddedLexer(RegexLexer): r'[^}\'"\[/#]', # exclude unsafe characters r'}(?=[^%]|$)', # } is okay as long as it's not followed by % r'}%(?=[^%]|$)', # ...well, one %'s okay, just not two... - r'[^\\][\\][{}]', # ...and } is okay if it's escaped + r'[^\\]\\[{}]', # ...and } is okay if it's escaped # allow / if it's preceded with one of these symbols # (ragel EOF actions) diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py index 13201912..df9b56f4 100644 --- a/pygments/lexers/shell.py +++ b/pygments/lexers/shell.py @@ -390,13 +390,13 @@ class PowerShellLexer(RegexLexer): (r'`[\'"$@-]', Punctuation), (r'"', String.Double, 'string'), (r"'([^']|'')*'", String.Single), - (r'(\$|@@|@)((global|script|private|env):)?[a-z0-9_]+', + (r'(\$|@@|@)((global|script|private|env):)?\w+', Name.Variable), (r'(%s)\b' % '|'.join(keywords), Keyword), (r'-(%s)\b' % '|'.join(operators), Operator), - (r'(%s)-[a-z_][a-z0-9_]*\b' % '|'.join(verbs), Name.Builtin), - (r'\[[a-z_\[][a-z0-9_. `,\[\]]*\]', Name.Constant), # .net [type]s - (r'-[a-z_][a-z0-9_]*', Name), + (r'(%s)-[a-z_]\w*\b' % '|'.join(verbs), Name.Builtin), + (r'\[[a-z_\[][\w. `,\[\]]*\]', Name.Constant), # .net [type]s + (r'-[a-z_]\w*', Name), (r'\w+', Name), (r'[.,;@{}\[\]$()=+*/\\&%!~?^`|<>-]|::', Punctuation), ], diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py index 53df0f75..7540f079 100644 --- a/pygments/lexers/sql.py +++ b/pygments/lexers/sql.py @@ -150,10 +150,10 @@ class PostgresLexer(PostgresBase, RegexLexer): (r"(E|U&)?'(''|[^'])*'", String.Single), (r'(U&)?"(""|[^"])*"', String.Name), # quoted identifier (r'(?s)(\$[^\$]*\$)(.*?)(\1)', language_callback), - (r'[a-zA-Z_]\w*', Name), + (r'[a-z_]\w*', Name), # psql variable in SQL - (r""":(['"]?)[a-z][a-z0-9_]*\b\1""", Name.Variable), + (r""":(['"]?)[a-z]\w*\b\1""", Name.Variable), (r'[;:()\[\]\{\},\.]', Punctuation), ], @@ -192,10 +192,10 @@ class PlPgsqlLexer(PostgresBase, RegexLexer): # Add specific PL/pgSQL rules (before the SQL ones) tokens['root'][:0] = [ - (r'\%[a-z][a-z0-9_]*\b', Name.Builtin), # actually, a datatype + (r'\%[a-z]\w*\b', Name.Builtin), # actually, a datatype (r':=', Operator), - (r'\<\<[a-z][a-z0-9_]*\>\>', Name.Label), - (r'\#[a-z][a-z0-9_]*\b', Keyword.Pseudo), # #variable_conflict + (r'\<\<[a-z]\w*\>\>', Name.Label), + (r'\#[a-z]\w*\b', Keyword.Pseudo), # #variable_conflict ] @@ -219,7 +219,7 @@ class PsqlRegexLexer(PostgresBase, RegexLexer): (r'\n', Text, 'root'), (r'\s+', Text), (r'\\[^\s]+', Keyword.Pseudo), - (r""":(['"]?)[a-z][a-z0-9_]*\b\1""", Name.Variable), + (r""":(['"]?)[a-z]\w*\b\1""", Name.Variable), (r"'(''|[^'])*'", String.Single), (r"`([^`])*`", String.Backtick), (r"[^\s]+", String.Symbol), @@ -435,7 +435,7 @@ class SqlLexer(RegexLexer): # TODO: Backslash escapes? (r"'(''|[^'])*'", String.Single), (r'"(""|[^"])*"', String.Symbol), # not a real string literal in ANSI SQL - (r'[a-zA-Z_]\w*', Name), + (r'[a-z_]\w*', Name), (r'[;:()\[\],\.]', Punctuation) ], 'multiline-comments': [ @@ -506,10 +506,10 @@ class MySqlLexer(RegexLexer): # TODO: this list is not complete (r'\b(auto_increment|engine|charset|tables)\b', Keyword.Pseudo), (r'(true|false|null)', Name.Constant), - (r'([a-zA-Z_]\w*)(\s*)(\()', + (r'([a-z_]\w*)(\s*)(\()', bygroups(Name.Function, Text, Punctuation)), - (r'[a-zA-Z_]\w*', Name), - (r'@[A-Za-z0-9]*[._]*[A-Za-z0-9]*', Name.Variable), + (r'[a-z_]\w*', Name), + (r'@[a-z0-9]*[._]*[a-z0-9]*', Name.Variable), (r'[;:()\[\],\.]', Punctuation) ], 'multiline-comments': [ @@ -584,7 +584,7 @@ class RqlLexer(RegexLexer): (r'[+*/<>=%-]', Operator), (r'(Any|is|instance_of|CWEType|CWRelation)\b', Name.Builtin), (r'[0-9]+', Number.Integer), - (r'[A-Z_][A-Z0-9_]*\??', Name), + (r'[A-Z_]\w*\??', Name), (r"'(''|[^'])*'", String.Single), (r'"(""|[^"])*"', String.Single), (r'[;:()\[\],\.]', Punctuation) diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index 62d5da85..4d53dca6 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -753,7 +753,7 @@ class CheetahLexer(RegexLexer): (r'''(?sx) (.+?) # anything, followed by: (?: - (?=[#][#a-zA-Z]*) | # an eval comment + (?=\#[#a-zA-Z]*) | # an eval comment (?=\$[a-zA-Z_{]) | # a substitution \Z # end of string ) @@ -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_$][\w.]*)(\s*)(\()', + (r'([a-z_$][\w.]*)(\s*)(\()', bygroups(Name.Function, Text, Punctuation)), - (r'[A-Za-z_$][\w.]*', Name.Variable), + (r'[a-z_$][\w.]*', Name.Variable), (r'[()\[\]{};:,.\\]', Punctuation), (r'\s+', Text), ], diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py index d855ec79..10675654 100644 --- a/pygments/lexers/text.py +++ b/pygments/lexers/text.py @@ -589,7 +589,7 @@ class ApacheConfLexer(RegexLexer): (r'(#.*?)$', Comment), (r'(<[^\s>]+)(?:(\s+)(.*?))?(>)', bygroups(Name.Tag, Text, String, Name.Tag)), - (r'([a-zA-Z]\w*)(\s+)', + (r'([a-z]\w*)(\s+)', bygroups(Name.Builtin, Text), 'value'), (r'\.+', Text), ], @@ -598,7 +598,7 @@ class ApacheConfLexer(RegexLexer): (r'[^\S\n]+', Text), (r'\d+\.\d+\.\d+\.\d+(?:/\d+)?', Number), (r'\d+', Number), - (r'/([a-zA-Z0-9][\w./-]+)', String.Other), + (r'/([a-z0-9][\w./-]+)', String.Other), (r'(on|off|none|any|all|double|email|dns|min|minimal|' r'os|productonly|full|emerg|alert|crit|error|warn|' r'notice|info|debug|registry|script|inetd|standalone|' @@ -776,7 +776,7 @@ class RstLexer(RegexLexer): (r'^( *)(:.*?:)([ \t]+)(.*?)$', bygroups(Text, Name.Class, Text, Name.Function)), # Definition list - (r'^([^\s].*(?<!::)\n)((?:(?: +.*)\n)+)', + (r'^(\S.*(?<!::)\n)((?:(?: +.*)\n)+)', bygroups(using(this, state='inline'), using(this, state='inline'))), # Code blocks (r'(::)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\3.*|)\n)+)', diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py index ab8a6bcc..5260b9f5 100644 --- a/pygments/lexers/web.py +++ b/pygments/lexers/web.py @@ -802,7 +802,7 @@ class PhpLexer(RegexLexer): # Note that a backslash is included in the following two patterns # PHP uses a backslash as a namespace separator _ident_char = r'[\\\w]|[^\x00-\x7f]' - _ident_begin = r'(?:[\\_a-zA-Z]|[^\x00-\x7f])' + _ident_begin = r'(?:[\\_a-z]|[^\x00-\x7f])' _ident_end = r'(?:' + _ident_char + ')*' _ident_inner = _ident_begin + _ident_end @@ -852,7 +852,7 @@ class PhpLexer(RegexLexer): (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), (r'\d+[eE][+-]?[0-9]+', Number.Float), (r'0[0-7]+', Number.Oct), - (r'0[xX][a-fA-F0-9]+', Number.Hex), + (r'0[xX][a-f0-9]+', Number.Hex), (r'\d+', Number.Integer), (r'0b[01]+', Number.Binary), (r"'([^'\\]*(?:\\.[^'\\]*)*)'", String.Single), @@ -868,7 +868,7 @@ class PhpLexer(RegexLexer): 'string': [ (r'"', String.Double, '#pop'), (r'[^{$"\\]+', String.Double), - (r'\\([nrt\"$\\]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})', String.Escape), + (r'\\([nrt\"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})', String.Escape), (r'\$' + _ident_inner + '(\[\S+?\]|->' + _ident_inner + ')?', String.Interpol), (r'(\{\$\{)(.*?)(\}\})', @@ -2344,7 +2344,7 @@ class SassLexer(ExtendedRegexLexer): (r'(@mixin)( [\w-]+)', bygroups(Keyword, Name.Function), 'value'), (r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'), (r'@extend', Keyword, 'selector'), - (r'@[a-z0-9_-]+', Keyword, 'selector'), + (r'@[\w-]+', Keyword, 'selector'), (r'=[\w-]+', Name.Function, 'value'), (r'\+[\w-]+', Name.Decorator, 'value'), (r'([!$][\w-]\w*)([ \t]*(?:(?:\|\|)?=|:))', @@ -2417,7 +2417,7 @@ class ScssLexer(RegexLexer): (r'(@mixin)( [\w-]+)', bygroups(Keyword, Name.Function), 'value'), (r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'), (r'@extend', Keyword, 'selector'), - (r'@[a-z0-9_-]+', Keyword, 'selector'), + (r'@[\w-]+', Keyword, 'selector'), (r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'), (r'(?=[^;{}][;}])', Name.Attribute, 'attr'), (r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'), @@ -2837,8 +2837,8 @@ class ScamlLexer(ExtendedRegexLexer): ], 'css': [ - (r'\.[a-z0-9_:-]+', Name.Class, 'tag'), - (r'\#[a-z0-9_:-]+', Name.Function, 'tag'), + (r'\.[\w:-]+', Name.Class, 'tag'), + (r'\#[\w:-]+', Name.Function, 'tag'), ], 'eval-or-plain': [ @@ -2851,7 +2851,7 @@ class ScamlLexer(ExtendedRegexLexer): 'content': [ include('css'), - (r'%[a-z0-9_:-]+', Name.Tag, 'tag'), + (r'%[\w:-]+', Name.Tag, 'tag'), (r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'), (r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)', bygroups(Comment, Comment.Special, Comment), @@ -2890,16 +2890,16 @@ class ScamlLexer(ExtendedRegexLexer): 'html-attributes': [ (r'\s+', Text), - (r'[a-z0-9_:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'), - (r'[a-z0-9_:-]+', Name.Attribute), + (r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'), + (r'[\w:-]+', Name.Attribute), (r'\)', Text, '#pop'), ], 'html-attribute-value': [ (r'[ \t]+', Text), - (r'[a-z0-9_]+', Name.Variable, '#pop'), - (r'@[a-z0-9_]+', Name.Variable.Instance, '#pop'), - (r'\$[a-z0-9_]+', Name.Variable.Global, '#pop'), + (r'\w+', Name.Variable, '#pop'), + (r'@\w+', Name.Variable.Instance, '#pop'), + (r'\$\w+', Name.Variable.Global, '#pop'), (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), ], @@ -2947,8 +2947,8 @@ class JadeLexer(ExtendedRegexLexer): ], 'css': [ - (r'\.[a-z0-9_:-]+', Name.Class, 'tag'), - (r'\#[a-z0-9_:-]+', Name.Function, 'tag'), + (r'\.[\w:-]+', Name.Class, 'tag'), + (r'\#[\w:-]+', Name.Function, 'tag'), ], 'eval-or-plain': [ @@ -2976,7 +2976,7 @@ class JadeLexer(ExtendedRegexLexer): '#pop'), (r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'), '#pop'), - (r'[a-z0-9_:-]+', Name.Tag, 'tag'), + (r'[\w:-]+', Name.Tag, 'tag'), (r'\|', Text, 'eval-or-plain'), ], @@ -2999,16 +2999,16 @@ class JadeLexer(ExtendedRegexLexer): 'html-attributes': [ (r'\s+', Text), - (r'[a-z0-9_:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'), - (r'[a-z0-9_:-]+', Name.Attribute), + (r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'), + (r'[\w:-]+', Name.Attribute), (r'\)', Text, '#pop'), ], 'html-attribute-value': [ (r'[ \t]+', Text), - (r'[a-z0-9_]+', Name.Variable, '#pop'), - (r'@[a-z0-9_]+', Name.Variable.Instance, '#pop'), - (r'\$[a-z0-9_]+', Name.Variable.Global, '#pop'), + (r'\w+', Name.Variable, '#pop'), + (r'@\w+', Name.Variable.Instance, '#pop'), + (r'\$\w+', Name.Variable.Global, '#pop'), (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), ], @@ -4285,8 +4285,8 @@ class MaskLexer(RegexLexer): (r'"', String, 'string-double'), (r'([\w-]+)', Name.Tag, 'node'), (r'([^\.#;{>\s]+)', Name.Class, 'node'), - (r'(#[\w_-]+)', Name.Function, 'node'), - (r'(\.[\w_-]+)', Name.Variable.Class, 'node') + (r'(#[\w-]+)', Name.Function, 'node'), + (r'(\.[\w-]+)', Name.Variable.Class, 'node') ], 'string-base': [ (r'\\.', String.Escape), @@ -4323,8 +4323,8 @@ class MaskLexer(RegexLexer): (r'\.', Name.Variable.Class, 'node-class'), (r'\#', Name.Function, 'node-id'), (r'style[ \t]*=', Name.Attribute, 'node-attr-style-value'), - (r'[\w_:-]+[ \t]*=', Name.Attribute, 'node-attr-value'), - (r'[\w_:-]+', Name.Attribute), + (r'[\w:-]+[ \t]*=', Name.Attribute, 'node-attr-value'), + (r'[\w:-]+', Name.Attribute), (r'[>{;]', Punctuation, '#pop') ], 'node-class': [ @@ -4339,7 +4339,7 @@ class MaskLexer(RegexLexer): ], 'node-attr-value':[ (r'\s+', Text), - (r'[\w_]+', Name.Variable, '#pop'), + (r'\w+', Name.Variable, '#pop'), (r"'", String, 'string-single-pop2'), (r'"', String, 'string-double-pop2'), (r'', Text, '#pop') @@ -4352,8 +4352,8 @@ class MaskLexer(RegexLexer): ], 'css-base': [ (r'\s+', Text), - (r"[;]", Punctuation), - (r"[\w\-_]+\s*:", Name.Builtin) + (r";", Punctuation), + (r"[\w\-]+\s*:", Name.Builtin) ], 'css-single-end': [ include('css-base'), |