pganalyze/libpg_query

Add comments to the parsed AST

Opened this issue · 0 comments

Follow-on issue to #15 and #43

As of pg_query 2.0, comment tokens are included in the scan output!

This is accomplished with a patch in the lexer, and this could similarly be implemented with a patch to the parser (though it may be a heavier lift).

Alternatively, adding start/end location data to all nodes in the parsed AST may provide much of the same purpose (making it easier to match AST nodes with comments in the scanner) and could be simpler to implement.

@lfittl has indicated he does not have time to build this in the near-term, but would be open to reviewing a PR for this.

(I'm interested in doing this myself but am not likely to be able to in the near future either.)