I've been experimenting with some simple rules as I get used to the Lemon
parser. This very simple parser file works correctly. A database consists
of an entrylist which consists of any number of commands:
database ::= entrylist. { printf("Constructed the root\n"); }
entrylist ::= command.
entrylist ::= entrylist command.
command ::= CMDNAME INTEGER TEXT EOL. { printf("Reducing to command
state\n"); }
For reference, I'm feeding the parser with:
Parse(pParser, CMDNAME, 0);
Parse(pParser, INTEGER, 0);
Parse(pParser, TEXT, 0);
Parse(pParser, EOL, 0);
However, if I enhance the command slightly to accept any number of optional
arguments:
database ::= entrylist. { printf("Constructed the root\n"); }
entrylist ::= command.
entrylist ::= entrylist command.
command ::= CMDNAME cmdargs EOL. { printf("Reducing to command
state\n"); }
cmdargs ::= .
cmdargs ::= cmdargs cmdarg.
cmdarg ::= INTEGER.
cmdarg ::= TEXT.
This causes an assertion failure:
> test.exe
Debug: Input 'CMDNAME'
Debug: Shift 'CMDNAME', go to state 3
Debug: Return. Stack=[CMDNAME]
Debug: Input 'INTEGER'
Assertion failed: stateno <= YY_SHIFT_COUNT, file testpar.c, line 512
I'm trying to figure out if this is a bug or something I'm just not
understanding correctly.
Thanks, Conor.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users