diff options
author | Linus Groh <mail@linusgroh.de> | 2020-09-25 20:56:28 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-25 23:58:42 +0200 |
commit | 7d836656355c0766b71bb7b34d2ef461128b68ef (patch) | |
tree | 603263cc2eeb4c956604f1c65423a9e6915c6854 | |
parent | 43b29286888994560f9df815ac05e286174bdc9f (diff) | |
download | serenity-7d836656355c0766b71bb7b34d2ef461128b68ef.zip |
LibJS+LibGUI+js: Handle UnterminatedRegexLiteral in syntax highlighters
-rw-r--r-- | Libraries/LibGUI/JSSyntaxHighlighter.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibJS/MarkupGenerator.cpp | 3 | ||||
-rw-r--r-- | Userland/js.cpp | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibGUI/JSSyntaxHighlighter.cpp b/Libraries/LibGUI/JSSyntaxHighlighter.cpp index 3d8785c22c..5fba9bc2db 100644 --- a/Libraries/LibGUI/JSSyntaxHighlighter.cpp +++ b/Libraries/LibGUI/JSSyntaxHighlighter.cpp @@ -49,6 +49,7 @@ static TextStyle style_for_token_type(Gfx::Palette palette, JS::TokenType type) case JS::TokenType::RegexLiteral: case JS::TokenType::RegexFlags: case JS::TokenType::UnterminatedStringLiteral: + case JS::TokenType::UnterminatedRegexLiteral: return { palette.syntax_string() }; case JS::TokenType::BracketClose: case JS::TokenType::BracketOpen: diff --git a/Libraries/LibJS/MarkupGenerator.cpp b/Libraries/LibJS/MarkupGenerator.cpp index 0b518f1a7d..dfaa5cffcc 100644 --- a/Libraries/LibJS/MarkupGenerator.cpp +++ b/Libraries/LibJS/MarkupGenerator.cpp @@ -226,6 +226,7 @@ MarkupGenerator::StyleType MarkupGenerator::style_type_for_token(Token token) case TokenType::RegexLiteral: case TokenType::RegexFlags: case TokenType::UnterminatedStringLiteral: + case TokenType::UnterminatedRegexLiteral: return StyleType::String; case TokenType::BracketClose: case TokenType::BracketOpen: @@ -330,7 +331,7 @@ MarkupGenerator::StyleType MarkupGenerator::style_type_for_token(Token token) case TokenType::Identifier: return StyleType::Identifier; default: - dbg() << "Unknown style type for token" << token.name(); + dbg() << "Unknown style type for token " << token.name(); ASSERT_NOT_REACHED(); } } diff --git a/Userland/js.cpp b/Userland/js.cpp index adff6c17a6..5a9dc05834 100644 --- a/Userland/js.cpp +++ b/Userland/js.cpp @@ -616,6 +616,7 @@ int main(int argc, char** argv) case JS::TokenType::RegexLiteral: case JS::TokenType::RegexFlags: case JS::TokenType::UnterminatedStringLiteral: + case JS::TokenType::UnterminatedRegexLiteral: stylize({ start, end }, { Line::Style::Foreground(Line::Style::XtermColor::Green), Line::Style::Bold }); break; case JS::TokenType::BracketClose: |