1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Lemon correctly recognizes an empty grammar and errors out.

Fix for a bug reported on the sqlite-users mailing list. (CVS 3226)

FossilOrigin-Name: 55392922686691db3d41525a7f4cb7f976e73467
This commit is contained in:
drh
2006-06-13 13:27:46 +00:00
parent e7d46464d1
commit 954f6b4763
3 changed files with 9 additions and 18 deletions

View File

@ -1423,6 +1423,7 @@ char **argv;
fprintf(stderr,"Exactly one filename argument is required.\n");
exit(1);
}
memset(&lem, 0, sizeof(lem));
lem.errorcnt = 0;
/* Initialize the machine */
@ -1432,23 +1433,13 @@ char **argv;
lem.argv0 = argv[0];
lem.filename = OptArg(0);
lem.basisflag = basisflag;
lem.has_fallback = 0;
lem.nconflict = 0;
lem.name = lem.include = lem.arg = lem.tokentype = lem.start = 0;
lem.vartype = 0;
lem.stacksize = 0;
lem.error = lem.overflow = lem.failure = lem.accept = lem.tokendest =
lem.tokenprefix = lem.outname = lem.extracode = 0;
lem.vardest = 0;
lem.tablesize = 0;
Symbol_new("$");
lem.errsym = Symbol_new("error");
lem.wildcard = 0;
/* Parse the input file */
Parse(&lem);
if( lem.errorcnt ) exit(lem.errorcnt);
if( lem.rule==0 ){
if( lem.nrule==0 ){
fprintf(stderr,"Empty grammar.\n");
exit(1);
}