diff options
-rw-r--r-- | pygments/lexers/asm.py | 4 | ||||
-rw-r--r-- | pygments/lexers/functional.py | 14 | ||||
-rw-r--r-- | pygments/lexers/other.py | 2 | ||||
-rw-r--r-- | pygments/lexers/web.py | 27 |
4 files changed, 23 insertions, 24 deletions
diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py index fc361e2f..13649521 100644 --- a/pygments/lexers/asm.py +++ b/pygments/lexers/asm.py @@ -318,7 +318,7 @@ class NasmLexer(RegexLexer): filenames = ['*.asm', '*.ASM'] mimetypes = ['text/x-nasm'] - identifier = r'[a-zA-Z$._?][a-zA-Z0-9$._?#@~]*' + 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)' octn = r'[0-7]+q' binn = r'[01]+b' @@ -417,7 +417,7 @@ class Ca65Lexer(RegexLexer): r'|cl[cvdi]|se[cdi]|jmp|jsr|bne|beq|bpl|bmi|bvc|bvs|bcc|bcs' r'|p[lh][ap]|rt[is]|brk|nop|ta[xy]|t[xy]a|txs|tsx|and|ora|eor' r'|bit)\b', Keyword), - (r'\.[a-z0-9_]+', Keyword.Pseudo), + (r'\.\w+', Keyword.Pseudo), (r'[-+~*/^&|!<>=]', Operator), (r'"[^"\n]*.', String), (r"'[^'\n]*.", String.Char), diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index cd4828fb..72fb37bc 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -732,7 +732,7 @@ class CommonLispLexer(RegexLexer): ### couple of useful regexes # characters that are not macro-characters and can be used to begin a symbol - nonmacro = r'\\.|[a-zA-Z0-9!$%&*+-/<=>?@\[\]^_{}~]' + nonmacro = r'\\.|[\w!$%&*+-/<=>?@\[\]^{}~]' constituent = nonmacro + '|[#.:]' terminated = r'(?=[ "()\'\n,;`])' # whitespace or terminating macro characters @@ -1450,7 +1450,7 @@ class SMLLexer(RegexLexer): (r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'), # Regular identifiers, long and otherwise - (r'\'[0-9a-zA-Z_\']*', Name.Decorator), + (r'\'[\w\']*', Name.Decorator), (r'(%s)(\.)' % alphanumid_re, long_id_callback, "dotted"), (r'(%s)' % alphanumid_re, id_callback), (r'(%s)' % symbolicid_re, id_callback), @@ -2437,7 +2437,7 @@ class NewLispLexer(RegexLexer): ] # valid names - valid_name = r'([a-zA-Z0-9!$%&*+.,/<=>?@^_~|-])+|(\[.*?\])+' + valid_name = r'([\w!$%&*+.,/<=>?@^~|-])+|(\[.*?\])+' tokens = { 'root': [ @@ -2552,14 +2552,14 @@ class NixLexer(RegexLexer): (r"''", String.Single, 'singlequote'), # paths - (r'[a-zA-Z0-9._+-]*(\/[a-zA-Z0-9._+-]+)+', Literal), - (r'\<[a-zA-Z0-9._+-]+(\/[a-zA-Z0-9._+-]+)*\>', Literal), + (r'[\w.+-]*(\/[\w.+-]+)+', Literal), + (r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal), # urls - (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9%/?:@&=+$,\\_.!~*\'-]+', Literal), + (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal), # names of variables - (r'[a-zA-Z0-9-_]+\s*=', String.Symbol), + (r'[\w-]+\s*=', String.Symbol), (r'[a-zA-Z_][\w\'-]*', Text), ], diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index 65f7a6c2..cef71f95 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -4357,7 +4357,7 @@ class RedLexer(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), ], diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py index e62591a5..2a80403a 100644 --- a/pygments/lexers/web.py +++ b/pygments/lexers/web.py @@ -801,7 +801,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'[\\_a-zA-Z0-9]|[^\x00-\x7f]' + _ident_char = r'[\\\w]|[^\x00-\x7f]' _ident_begin = r'(?:[\\_a-zA-Z]|[^\x00-\x7f])' _ident_end = r'(?:' + _ident_char + ')*' _ident_inner = _ident_begin + _ident_end @@ -1118,8 +1118,8 @@ class MxmlLexer(RegexLexer): ('<!--', Comment, 'comment'), (r'<\?.*?\?>', Comment.Preproc), ('<![^>]*>', Comment.Preproc), - (r'<\s*[a-zA-Z0-9:._-]+', Name.Tag, 'tag'), - (r'<\s*/\s*[a-zA-Z0-9:._-]+\s*>', Name.Tag), + (r'<\s*[\w:.-]+', Name.Tag, 'tag'), + (r'<\s*/\s*[\w:.-]+\s*>', Name.Tag), ], 'comment': [ ('[^-]+', Comment), @@ -1161,11 +1161,10 @@ class HaxeLexer(ExtendedRegexLexer): r'inline|using|null|true|false|abstract)\b') # idtype in lexer.mll - typeid = r'_*[A-Z][_a-zA-Z0-9]*' + typeid = r'_*[A-Z]\w*' # combined ident and dollar and idtype - ident = r'(?:_*[a-z][_a-zA-Z0-9]*|_+[0-9][_a-zA-Z0-9]*|' + typeid + \ - '|_+|\$[_a-zA-Z0-9]+)' + ident = r'(?:_*[a-z]\w*|_+[0-9]\w*|' + typeid + '|_+|\$\w+)' binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|' r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|' @@ -2038,8 +2037,8 @@ class HamlLexer(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': [ @@ -2052,7 +2051,7 @@ class HamlLexer(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), @@ -2088,16 +2087,16 @@ class HamlLexer(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'), ], |