mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
Fix website demo's string highlighting behaviour (#942)
Fixes #935: * String literals that include `\z` escape sequence followed by newline characters are now correctly highlighted. * Unescaped backslash (`\`) character at the end of the line no longer acts like the `\z` escape sequence inside string literals when highlighting.
This commit is contained in:
parent
4f82a77396
commit
e78897229a
@ -108,15 +108,19 @@
|
||||
|
||||
function string(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, ch;
|
||||
var escaped = false, ignoreWhitespace = false, ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
if (ch == quote && !escaped) {
|
||||
break;
|
||||
}
|
||||
if (ch == "z" && escaped) {
|
||||
stream.eatSpace();
|
||||
ignoreWhitespace = stream.eol();
|
||||
}
|
||||
escaped = !escaped && ch == "\\";
|
||||
}
|
||||
|
||||
if (!escaped) {
|
||||
if (!ignoreWhitespace) {
|
||||
state.cur = normal;
|
||||
}
|
||||
return "string";
|
||||
|
Loading…
Reference in New Issue
Block a user