syntax
syntax copied to clipboard
source-map, or at least some comments, for generated code
it's pretty hard to debug the generated parser, when it contains more than 500 handlers.
I crudely added the following line to the template, so I could find the handler's corresponding grammar rule in seconds.
buildSemanticAction(production) {
....
// Verbose debug info
action = action + `\n// raw production: ${production._rawLHS} -> ${production._rawRHS}\n`;
....
},
It's not a fancy souce-mapping solution, but maybe that's enough for now. Maybe I could polish it a little and file a PR, what do you think?