Dear Noel and Team,
compliments! I would like to ask for your kind help please.
My objective is to write an ANTLR V4. grammar for H2 and of course lazy as I am I would like to use the existing BNF from the CSV and because I am very lazy I do not want to parse that myself, but use the H2 BNF parser.
I managed already to extract the H2 commands, which will go into the ANTLR parser definition, e. g.:
SELECT [TOP term [PERCENT] [WITH TIES]] [DISTINCT [ON ( expression [, ...] )] | ALL] selectExpression [, ...] [FROM tableExpression [, ...]] [WHERE expression] [GROUP BY groupingElement [, ...]] [HAVING expression] [WINDOW windowName AS windowSpecification [, ...]] [QUALIFY expression] [UNION [ALL] | EXCEPT | MINUS | INTERSECT query] [ORDER BY selectOrder [, ...]] [OFFSET expression ROW | ROWS] [FETCH FIRST | NEXT [expression [PERCENT]] ROW | ROWS ONLY | WITH TIES] [LIMIT expression [OFFSET expression]] [FOR UPDATE] ;
After some changes to the various Rule Classes, I am also able to extract the fragments for the Lexer, e. g.:
term
expression
selectExpression
tableExpression
groupingElement
windowName
windowSpecification
query
selectOrder
However, I am stuck in getting the definition of these fragments from the BNF classes.
For example, in the Spreadsheet, you have defined TERM as
{ value
| column
| ?[ int ]
| sequenceValueExpression
| function
| { - | + } term
| ( expression )
| arrayElementReference
| fieldReference
| query
| caseExpression
| castSpecification
| userDefinedFunctionName }
[ timeZone | intervalQualifier ]
But it seems like I can't get that definition from BNF directly, but also not from the RuleElement term itself.
So how to get that red definition please?
Also, most of the properties in RuleList, RuleFixed, RuleOptional and RuleElement are private and there are no public getters.
Would you like to consider/accept a patch with getters for these properties? Especially list in RuleList is crucial.
Thank you as always and best regards
Andreas