diff --git a/lexers/j/javascript.go b/lexers/j/javascript.go index a50cb24b3..ffa20c3b1 100644 --- a/lexers/j/javascript.go +++ b/lexers/j/javascript.go @@ -49,6 +49,7 @@ var JavascriptRules = Rules{ {"`", LiteralStringBacktick, Pop(1)}, {`\\\\`, LiteralStringBacktick, nil}, {"\\\\`", LiteralStringBacktick, nil}, + {"\\\\[^`\\\\]", LiteralStringBacktick, nil}, {`\$\{`, LiteralStringInterpol, Push("interp-inside")}, {`\$`, LiteralStringBacktick, nil}, {"[^`\\\\$]+", LiteralStringBacktick, nil}, diff --git a/lexers/testdata/javascript.actual b/lexers/testdata/javascript.actual index d0eac9af3..0506772a8 100644 --- a/lexers/testdata/javascript.actual +++ b/lexers/testdata/javascript.actual @@ -1,2 +1,3 @@ sum = parseInt(num1) + parseInt(num2) // "+" means "add" -alert("Sum = " + sum) // "+" means combine into a string \ No newline at end of file +alert("Sum = " + sum) // "+" means combine into a string +const filePath = String.raw`C:\Development\profile\aboutme.html`; diff --git a/lexers/testdata/javascript.expected b/lexers/testdata/javascript.expected index 094b33762..04c4264bf 100644 --- a/lexers/testdata/javascript.expected +++ b/lexers/testdata/javascript.expected @@ -25,5 +25,17 @@ {"type":"NameOther","value":"sum"}, {"type":"Punctuation","value":")"}, {"type":"Text","value":" "}, - {"type":"CommentSingle","value":"// \"+\" means combine into a string\n"} + {"type":"CommentSingle","value":"// \"+\" means combine into a string\n"}, + {"type":"KeywordReserved","value":"const"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"filePath"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"="}, + {"type":"Text","value":" "}, + {"type":"NameBuiltin","value":"String"}, + {"type":"Punctuation","value":"."}, + {"type":"NameOther","value":"raw"}, + {"type":"LiteralStringBacktick","value":"`C:\\Development\\profile\\aboutme.html`"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"} ]