"Garrett Rooney" <[EMAIL PROTECTED]> wrote: > > > > Your grammer does not generate an empty string. That means > > if you call the parser with an EOF token first, without any > > prior tokens, you are going to get a syntax error. The > > "yymajor==0" test was removed in order to get this to > > work correctly. Geert Janssen at IBM found this bug back > > in November - his grammar does not generate an empty string > > but lemon was not giving him a syntax error like it should > > if he passed in an empty string. If I add the yymajor==0 > > test back, it will reintroduce the bug. > > Hmm. I don't believe that's happening, but I'll look into adding > something to deal with that case. > > > Perhaps you are calling Parse() with EOF twice in a row > > when you should only be calling it once? That would trigger > > the syntax error. Or perhaps you should adjust your grammar > > to accept an empty string? > > Nope, I only send EOF in one location, the lexer never produces it, > and I only pass it in after I've run out of tokens from the lexer. > > > The %extra_argument that gets passed to the %syntax_error procedure > > should be the %extra_argument that got passed into with the > > call to Parse() that contained the EOF token. If that %extra_argument > > was NULL, then the %syntax_error procedure will get a NULL. > > Perhaps you can either pass in a non-null parameter to Parse > > or check for NULL in %syntax_error and branch accordingly. > > The extra argument passed in to the parse function is a pointer to > memory on the stack. It's just not possible for it to be null, unless > something is messing with that value before it gets into the > %syntax_error block... >
I don't have any more ideas about what might be going wrong. Can you send me a reproducible test case that I use to track down the problem? -- D. Richard Hipp <[EMAIL PROTECTED]>