summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-11-06 12:45:29 +0100
committerGeorg Brandl <georg@python.org>2014-11-06 12:45:29 +0100
commit82f5d9d9ca267212ffd78e3319eebe29aef845a6 (patch)
treec4fa5b49b8a5d4be00ad7aad68286064b8171877 /pygments
parent6fe296e816745123f1d3dbb3a55d8033ddb943d9 (diff)
downloadpygments-82f5d9d9ca267212ffd78e3319eebe29aef845a6.tar.gz
Fix flags for JS.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/javascript.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py
index 0c22aa6e..2957d86c 100644
--- a/pygments/lexers/javascript.py
+++ b/pygments/lexers/javascript.py
@@ -40,7 +40,8 @@ class JavascriptLexer(RegexLexer):
mimetypes = ['application/javascript', 'application/x-javascript',
'text/x-javascript', 'text/javascript', ]
- flags = re.DOTALL | re.UNICODE
+ flags = re.DOTALL | re.UNICODE | re.MULTILINE
+
tokens = {
'commentsandwhitespace': [
(r'\s+', Text),
@@ -59,11 +60,11 @@ class JavascriptLexer(RegexLexer):
(r'\n', Text, '#pop')
],
'root': [
- (r'^#! ?/.*?\n', Comment), # shebang lines are recognized by node.js
+ (r'\A#! ?/.*?\n', Comment), # shebang lines are recognized by node.js
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
include('commentsandwhitespace'),
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
- r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
+ r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
(r'[})\].]', Punctuation),
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'