Closed MoltonMontro closed 3 months ago
Side note: we can adjust the colors of tokens. Either by just changing the token type used by a rule (since being accurate/consistent with other languages doesn't really matter here), adding custom CSS, or making a custom formatter.
This is fantastic - great work! I'm still quite impressed that you did it with just regex.
As you mention, I agree it would be a good idea to have the "unturneddat"/"unturnedasset" language (more specific than "unturned") and playing around with the colors in future commits.
Following up on #311, this adds a custom lexer for UnturnedDat files (
.asset
and.dat
). There's a couple shortcomings, which I've added as comments within the lexer.Notably, the rule for matching numbers doesn't match values like
.1
. This could be changed, but we may need separate rules for integers and floats (possibly GUIDs). Also – lists/dictionaries that don't require key-value pairs (e.g., CraftingBlacklistAsset supports listing GUIDs without a key) will see those values matched as keys.Extensions can loaded locally from
_extensions
. Our custom lexer isunturned_lexer.py
, and is usable within code-blocks withunturned
. We could add other aliases such as unturnedasset, unturneddat, dat, etc. I've updated a couple code-blocks to use the lexer.