Digging through the syntax tree in search of certain nodes is not maintainable - the code becomes cryptic even for simple grammars. Is there a way to generate convenient type-safe wrappers for any syntactic construct? They can be done as wrappers over raw nodes.
Digging through the syntax tree in search of certain nodes is not maintainable - the code becomes cryptic even for simple grammars. Is there a way to generate convenient type-safe wrappers for any syntactic construct? They can be done as wrappers over raw nodes.
For example: Usage with wrappers (manually written out) And the grammar + wrappers themselves:
The same code without said wrappers, with digging through the syntax tree done manually, inline
The way I did it is not necessarily optimal, but I think it's pretty plausible. From experience working with Roslyn, it's a real good thing.