mirror of
https://github.com/RGBCube/serenity
synced 2025-10-13 17:22:17 +00:00
![]() So far we have three different syntax highlighters for LibJS: - js's Line::Editor stylization - JS::MarkupGenerator - GUI::JSSyntaxHighlighter This not only caused repetition of most token types in each highlighter but also a lot of inconsistency regarding the styling of certain tokens: - JSSyntaxHighlighter was considering TokenType::Period to be an operator whereas MarkupGenerator categorized it as punctuation. - MarkupGenerator was considering TokenType::{Break,Case,Continue, Default,Switch,With} control keywords whereas JSSyntaxHighlighter just disregarded them - MarkupGenerator considered some future reserved keywords invalid and others not. JSSyntaxHighlighter and js disregarded most Adding a new token type meant adding it to ENUMERATE_JS_TOKENS as well as each individual highlighter's switch/case construct. I added a TokenCategory enum, and each TokenType is now associated to a certain category, which the syntax highlighters then can use for styling rather than operating on the token type directly. This also makes changing a token's category everywhere easier, should we need to do that (e.g. I decided to make TokenType::{Period,QuestionMarkPeriod} TokenCategory::Operator for now, but we might want to change them to Punctuation. |
||
---|---|---|
.. | ||
LibAudio | ||
LibC | ||
LibChess | ||
LibCompress | ||
LibCore | ||
LibCpp | ||
LibCrypt | ||
LibCrypto | ||
LibDebug | ||
LibDesktop | ||
LibDiff | ||
LibELF | ||
LibGemini | ||
LibGfx | ||
LibGUI | ||
LibHTTP | ||
LibImageDecoderClient | ||
LibIPC | ||
LibJS | ||
LibKeyboard | ||
LibLine | ||
LibM | ||
LibMarkdown | ||
LibPCIDB | ||
LibProtocol | ||
LibPthread | ||
LibTar | ||
LibTextCodec | ||
LibThread | ||
LibTLS | ||
LibUnwind | ||
LibVT | ||
LibWeb | ||
LibX86 | ||
CMakeLists.txt |