diff options
author | Georg Brandl <georg@python.org> | 2017-01-17 08:40:29 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2017-01-17 08:40:29 +0100 |
commit | 17f8ed0bddf82483e5d007e68555d94beb0a999c (patch) | |
tree | 63fc6035a5a3bd149c4f2cff9fecab8d14975969 /pygments/lexers/javascript.py | |
parent | 6f07bcfacf39efd141f5f3b614c37aa6303e9af4 (diff) | |
parent | 94d23ec1b83cd66509e8d16c1ae69f31d2b6013d (diff) | |
download | pygments-git-17f8ed0bddf82483e5d007e68555d94beb0a999c.tar.gz |
Merged in takluyver/pygments-main/delay-pkg-resources (pull request #690)
Delay loading pkg_resources until it is needed.
Diffstat (limited to 'pygments/lexers/javascript.py')
-rw-r--r-- | pygments/lexers/javascript.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index a23ba184..4b47b15a 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -53,7 +53,7 @@ class JavascriptLexer(RegexLexer): 'slashstartsregex': [ include('commentsandwhitespace'), (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' - r'([gim]+\b|\B)', String.Regex, '#pop'), + r'([gimuy]+\b|\B)', String.Regex, '#pop'), (r'(?=/)', Text, ('#pop', 'badregex')), default('#pop') ], @@ -64,9 +64,14 @@ class JavascriptLexer(RegexLexer): (r'\A#! ?/.*?\n', Comment.Hashbang), # recognized by node.js (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'), include('commentsandwhitespace'), + (r'(\.\d+|[0-9]+\.[0-9]*)([eE][-+]?[0-9]+)?', Number.Float), + (r'0[bB][01]+', Number.Bin), + (r'0[oO][0-7]+', Number.Oct), + (r'0[xX][0-9a-fA-F]+', Number.Hex), + (r'[0-9]+', Number.Integer), + (r'\.\.\.|=>', Punctuation), (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|' - r'(<<|>>>?|=>|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'), - (r'\.\.\.', Punctuation), + r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'), (r'[{(\[;,]', Punctuation, 'slashstartsregex'), (r'[})\].]', Punctuation), (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|' @@ -84,11 +89,6 @@ class JavascriptLexer(RegexLexer): r'Error|eval|isFinite|isNaN|isSafeInteger|parseFloat|parseInt|' r'document|this|window)\b', Name.Builtin), (JS_IDENT, Name.Other), - (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), - (r'0b[01]+', Number.Bin), - (r'0o[0-7]+', Number.Oct), - (r'0x[0-9a-fA-F]+', Number.Hex), - (r'[0-9]+', Number.Integer), (r'"(\\\\|\\"|[^"])*"', String.Double), (r"'(\\\\|\\'|[^'])*'", String.Single), (r'`', String.Backtick, 'interp'), |