mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
LibJS: Add TokenType::TemplateLiteral
This is required for template literals - we're not quite there yet, but at
least the parser can now tell us when this token is encountered -
currently this yields "Unexpected token Invalid". Not really helpful.
The character is a "backtick", but as we already have
TokenType::{StringLiteral,RegexLiteral} this seemed like a fitting name.
This also enables syntax highlighting for template literals in the js
REPL and LibGUI's JSSyntaxHighlighter.
This commit is contained in:
committed by
Andreas Kling
parent
57caca3171
commit
95b51e857d
@@ -42,6 +42,7 @@ static TextStyle style_for_token_type(Gfx::Palette palette, JS::TokenType type)
|
||||
case JS::TokenType::NumericLiteral:
|
||||
return { palette.syntax_number() };
|
||||
case JS::TokenType::StringLiteral:
|
||||
case JS::TokenType::TemplateLiteral:
|
||||
case JS::TokenType::RegexLiteral:
|
||||
case JS::TokenType::UnterminatedStringLiteral:
|
||||
return { palette.syntax_string() };
|
||||
|
||||
Reference in New Issue
Block a user