mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 18:46:03 +00:00
LibJS+LibWebView: Treat trivia tokens as comments
Trivia is whatever whitespace and comments appear before a token. Previously this was always given a TokenCategory of Invalid, so it would be displayed as an error in the view-source page, with red wiggly underlines. Instead, treat it as what it actually is: whitespace and comments!
This commit is contained in:
parent
38c1ac767d
commit
9b7fb0850d
Notes:
github-actions[bot]
2025-03-04 20:59:17 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9b7fb0850d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3803
Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 5 additions and 1 deletions
|
@ -145,6 +145,7 @@ constexpr u32 const ZERO_WIDTH_JOINER { 0x200D };
|
|||
__ENUMERATE_JS_TOKEN(Throw, ControlKeyword) \
|
||||
__ENUMERATE_JS_TOKEN(Tilde, Operator) \
|
||||
__ENUMERATE_JS_TOKEN(TripleDot, Operator) \
|
||||
__ENUMERATE_JS_TOKEN(Trivia, Trivia) \
|
||||
__ENUMERATE_JS_TOKEN(Try, ControlKeyword) \
|
||||
__ENUMERATE_JS_TOKEN(Typeof, Keyword) \
|
||||
__ENUMERATE_JS_TOKEN(UnsignedShiftRight, Operator) \
|
||||
|
@ -168,6 +169,7 @@ constexpr size_t cs_num_of_js_tokens = static_cast<size_t>(TokenType::_COUNT_OF_
|
|||
|
||||
enum class TokenCategory {
|
||||
Invalid,
|
||||
Trivia,
|
||||
Number,
|
||||
String,
|
||||
Punctuation,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue