mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-29 21:56:56 +02:00
Fix incorrect javascript comment highlight (#104)
This commit is contained in:
parent
35126f9a94
commit
a35b8fe9bd
@ -65,6 +65,7 @@ var Javascript = Register(MustNewLexer(
|
||||
Filenames: []string{"*.js", "*.jsm"},
|
||||
MimeTypes: []string{"application/javascript", "application/x-javascript", "text/x-javascript", "text/javascript"},
|
||||
DotAll: true,
|
||||
EnsureNL: true,
|
||||
},
|
||||
JavascriptRules,
|
||||
))
|
||||
|
2
lexers/testdata/javascript.actual
vendored
Normal file
2
lexers/testdata/javascript.actual
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
sum = parseInt(num1) + parseInt(num2) // "+" means "add"
|
||||
alert("Sum = " + sum) // "+" means combine into a string
|
29
lexers/testdata/javascript.expected
vendored
Normal file
29
lexers/testdata/javascript.expected
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
[
|
||||
{"type":"NameOther","value":"sum"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameBuiltin","value":"parseInt"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameOther","value":"num1"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameBuiltin","value":"parseInt"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameOther","value":"num2"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// \"+\" means \"add\"\n"},
|
||||
{"type":"NameOther","value":"alert"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralStringDouble","value":"\"Sum = \""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":"+"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameOther","value":"sum"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"CommentSingle","value":"// \"+\" means combine into a string\n"}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user