[plsql] Rework grammar for better maintainability #1500
Labels
an:enhancement
An improvement on existing features / rules
in:grammar
About the grammar of a lexer or parser, eg, a parse/lex exception
Milestone
Current problems of the plsql grammar:
pmd/pmd-plsql/etc/grammar/PldocAST.jjt
Lines 636 to 651 in 178c9a8
Comment from #1493 (comment) copied here:
Doesn't this production try to do too much? I mean dumping the whole operator to a string makes it harder to analyse later on, whereas reifying the structure of the operator into an AST node would avoid losing this information.
E.g.
Having one node for each operator like
may seem verbose at first, but JJTree allows to write that inline as e.g.
instead of splitting this in very many productions. (I mention this because I think I've never come across this syntax anywhere in our grammars so maybe you're unaware of it.) This makes the AST structure very informative, but has the downside to increase the number of node classes significantly. If this is a problem, we may want to use a single common node type, e.g.
ASTPlsqlKeyword
, to represent any one-keyword AST node, with the image selecting the actual keyword used.This is obviously out of the scope of this PR, and maybe to be left for 7.0.0, but something to think about anyway.
I can open an issue to track it separately if you think this change is worth it.
The text was updated successfully, but these errors were encountered: