I am working with antlr v4 to write a t-sql parser. Is this warning a problem?
"sqlCommit rule contains an optional block with at least one alternative that may correspond to an empty string
My code is:
sqlCommit: COMMIT (TRAN | TRANSACTION | WORK)? id?; id: ID | CREATE | PROC | AS | EXEC | OUTPUT| INTTYPE |VARCHARTYPE |NUMERICTYPE |CHARTYPE |DECIMALTYPE | DOUBLETYPE | REALTYPE |FLOATTYPE|TINYINTTYPE|SMALLINTTYPE|DATETYPE|DATETIMETYPE|TIMETYPE|TIMESTAMPTYPE|BIGINTTYPE|UNSIGNEDBIGINTTYPE.......... ; ID: (LETTER | UNDERSCORE | RAUTE) (LETTER | [0-9]| DOT | UNDERSCORE)*
In the version, before I used the lexer rule identifier directly instead of the parser rule identifier in sqlCommit. But after changing the ID to id, a warning appears.
( Hint , if you are confused about the ID and id: I want to use the identifier of the analyzer rule instead of ID, because the identifier may be a literal, which may already correspond to another lexer rule)
Hello
EDIT Using "280Z28" I solved the problem. There was one more slash in the id id parser rule than needed: BITTYPE | CREATE | PROC | | AS | EXEC | OUTPUT |
So | | includes that the parser rule may match an empty string.
source share