Closed alxlg closed 9 months ago
For an editor you'd want a concrete rather than an abstract syntax tree. Even ignoring comments, there is a many -> one mapping from concrete syntax to the AST.
To give a bit more context here, while it is possible, with some extra engineering, to re-use the same parser for CST for an IDE and AST for "real" processing, this usually results in some combination of:
I think "have two parsers" is a reasonable starting point here.
Why comments like {% this %} are completely skipped instead of being in the AST (and ignored when converting to, for example, HTML)?
I mean, what if one wants to use a parser to develop a Djot GUI editor? How would one enable the user to see and edit comments if they aren't in the AST at all?