mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibJS+LibGUI+js: Handle UnterminatedRegexLiteral in syntax highlighters
This commit is contained in:
parent
43b2928688
commit
7d83665635
3 changed files with 4 additions and 1 deletions
|
@ -49,6 +49,7 @@ static TextStyle style_for_token_type(Gfx::Palette palette, JS::TokenType type)
|
||||||
case JS::TokenType::RegexLiteral:
|
case JS::TokenType::RegexLiteral:
|
||||||
case JS::TokenType::RegexFlags:
|
case JS::TokenType::RegexFlags:
|
||||||
case JS::TokenType::UnterminatedStringLiteral:
|
case JS::TokenType::UnterminatedStringLiteral:
|
||||||
|
case JS::TokenType::UnterminatedRegexLiteral:
|
||||||
return { palette.syntax_string() };
|
return { palette.syntax_string() };
|
||||||
case JS::TokenType::BracketClose:
|
case JS::TokenType::BracketClose:
|
||||||
case JS::TokenType::BracketOpen:
|
case JS::TokenType::BracketOpen:
|
||||||
|
|
|
@ -226,6 +226,7 @@ MarkupGenerator::StyleType MarkupGenerator::style_type_for_token(Token token)
|
||||||
case TokenType::RegexLiteral:
|
case TokenType::RegexLiteral:
|
||||||
case TokenType::RegexFlags:
|
case TokenType::RegexFlags:
|
||||||
case TokenType::UnterminatedStringLiteral:
|
case TokenType::UnterminatedStringLiteral:
|
||||||
|
case TokenType::UnterminatedRegexLiteral:
|
||||||
return StyleType::String;
|
return StyleType::String;
|
||||||
case TokenType::BracketClose:
|
case TokenType::BracketClose:
|
||||||
case TokenType::BracketOpen:
|
case TokenType::BracketOpen:
|
||||||
|
@ -330,7 +331,7 @@ MarkupGenerator::StyleType MarkupGenerator::style_type_for_token(Token token)
|
||||||
case TokenType::Identifier:
|
case TokenType::Identifier:
|
||||||
return StyleType::Identifier;
|
return StyleType::Identifier;
|
||||||
default:
|
default:
|
||||||
dbg() << "Unknown style type for token" << token.name();
|
dbg() << "Unknown style type for token " << token.name();
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,6 +616,7 @@ int main(int argc, char** argv)
|
||||||
case JS::TokenType::RegexLiteral:
|
case JS::TokenType::RegexLiteral:
|
||||||
case JS::TokenType::RegexFlags:
|
case JS::TokenType::RegexFlags:
|
||||||
case JS::TokenType::UnterminatedStringLiteral:
|
case JS::TokenType::UnterminatedStringLiteral:
|
||||||
|
case JS::TokenType::UnterminatedRegexLiteral:
|
||||||
stylize({ start, end }, { Line::Style::Foreground(Line::Style::XtermColor::Green), Line::Style::Bold });
|
stylize({ start, end }, { Line::Style::Foreground(Line::Style::XtermColor::Green), Line::Style::Bold });
|
||||||
break;
|
break;
|
||||||
case JS::TokenType::BracketClose:
|
case JS::TokenType::BracketClose:
|
||||||
|
|
Loading…
Add table
Reference in a new issue