Open Felienne opened 9 months ago
We had a PR open for this (#3988) which could be useful if we try this in the new CodeMirror system, esp since CodeMirror has a more powerful syntax highlighting system!
Yes, CodeMirror can parse the input using the Lezer parser generator. Hedy's syntax has some ambiguities: variables and text being one of them. However, Lezer also let's you build an external tokenizer if the Lezer built in one won't suffice. I think this feature can be used to built a data structure where we store the variables, but I'm not 100% sure of this.
It is not a high priority (since the don't have it now either) but it would be cool!! We could even highlight (with an error underline) undefined variables too!
Discussed in https://github.com/hedyorg/hedy/discussions/3929