mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Fix website demo's string highlighting behaviour
Fixes the highlighting behaviour of website demo when: * String includes `\z` escape sequence followed by newline characters. * String includes just a single backslash (`\`) character at the end of the line.
This commit is contained in:
parent
271c509046
commit
24702d250a
1 changed files with 8 additions and 3 deletions
|
@ -108,15 +108,20 @@
|
|||
|
||||
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) {
|
||||
ignoreWhitespace = true;
|
||||
stream.eatSpace();
|
||||
ignoreWhitespace = stream.eol();
|
||||
}
|
||||
escaped = !escaped && ch == "\\";
|
||||
}
|
||||
|
||||
if (!escaped) {
|
||||
if (!ignoreWhitespace) {
|
||||
state.cur = normal;
|
||||
}
|
||||
return "string";
|
||||
|
@ -164,4 +169,4 @@
|
|||
blockCommentEnd: "]]"
|
||||
}});
|
||||
CodeMirror.defineMIME("text/x-luau", "luau");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue