4 ms·
I’d be interested to see a re-usable implementation of joe's[0] syntax highlighting.[1] The format is powerful enough to allow for the proper highlighting of Py
by irdc 2y ago
I’d be interested to see a re-usable implementation of joe's[0] syntax highlighting.[1] The format is powerful enough to allow for the proper highlighting of Python f-strings.[2]
0. https://joe-editor.sf.net/ https://joe-editor.sf.net/
1. https://github.com/cmur2/joe-syntax/blob/joe-4.4/misc/HowItWorks.md https://github.com/cmur2/joe-syntax/blob/joe-4.4/misc/HowItW...
2. https://gist.github.com/irdc/6188f11b1e699d615ce2520f03f1d0da https://gist.github.com/irdc/6188f11b1e699d615ce2520f03f1d0d...
- pama 2y agoInterestingly, python f-strings changed their syntax at version 3.12, so highlighting should depend on the version.
- irdc 2y agoIt’s just that nesting them arbitrarily is now allowed, right? That shouldn’t matter much for a mere syntax highlighter then. And one could even argue that code that relies on this too much is not really for human consumption.
- pansa2 2y agoAlso, you can now use the same quote character that encloses an f-string within the {} expressions. That could make them harder to tokenize, because it makes it harder to recognise the end of the string.
- akira2501 2y agoI've actually made several lexers and parsers based on the joe DFA style of parsing. The state and transition syntax was something that I always understood much more easily than the standard tools. The downside is your rulesets tend to get more verbose and are a little bit harder to structure than they might ideally be in other languages more suited towards the purpose, but I actually think that's an advantage, as it's much easier to reason about every production rule when looking at the code.