mirror of
https://github.com/alecthomas/chroma.git
synced 2025-04-13 11:40:29 +02:00
JavaScript: String Single Character Escape Sequences (#415)
https://tc39.es/ecma262#table-string-single-character-escape-sequences
This commit is contained in:
parent
4453913798
commit
639fa3adc4
@ -49,6 +49,7 @@ var JavascriptRules = Rules{
|
||||
{"`", LiteralStringBacktick, Pop(1)},
|
||||
{`\\\\`, LiteralStringBacktick, nil},
|
||||
{"\\\\`", LiteralStringBacktick, nil},
|
||||
{"\\\\[^`\\\\]", LiteralStringBacktick, nil},
|
||||
{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
|
||||
{`\$`, LiteralStringBacktick, nil},
|
||||
{"[^`\\\\$]+", LiteralStringBacktick, nil},
|
||||
|
3
lexers/testdata/javascript.actual
vendored
3
lexers/testdata/javascript.actual
vendored
@ -1,2 +1,3 @@
|
||||
sum = parseInt(num1) + parseInt(num2) // "+" means "add"
|
||||
alert("Sum = " + sum) // "+" means combine into a string
|
||||
alert("Sum = " + sum) // "+" means combine into a string
|
||||
const filePath = String.raw`C:\Development\profile\aboutme.html`;
|
||||
|
14
lexers/testdata/javascript.expected
vendored
14
lexers/testdata/javascript.expected
vendored
@ -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"}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user