From: Jim Freeze Date: 2003-12-12T04:08:43+09:00 Subject: Re: problems with racc: $end token On Friday, 12 December 2003 at 3:55:31 +0900, Luke A. Kanies wrote: > On Fri, 12 Dec 2003, Jim Freeze wrote: > > > Well, in the sample code I see: > > > > @q.push [false, '$'] # optional from 1.3.7 > > Yep, I've tried that, along with about nine other variations of having an > end token. > > > I have successfully left that out of my parsers. > > Essentially, the samples just tokenize the file > > (and store the tokens in @q) then call do_parse. > > > > do_parse apparently gets tokens from the stack by > > calling next_token, which returns to tokens one > > at a time by calling @q.shift. This would suggest > > that when you are done all you need to do is return > > the same value as [].shift #=> nil. > > Yeah, all the code does it that way, but there shouldn't be a functional > difference between collecting the tokens in parse() and returning them in > next_token(), and just collecting and returning them in next_token(). > Either way, I've switched to a method like the examples, and I've > corrected my regex problems, and I still get an error. > I agree. Could be a grammar/file syntax mismatch. > At this point I think it's a problem with my grammar, that I'm somehow not > correctly specifying the end of the parsing. Obviously, though, I don't > know how to say "hey, the file is over, stop looking" or whatever the > magic words are. I _know_ that the false token is supposed to do that, > but for some reason racc thinks it shouldn't be expecting that token yet. > > In case anyone feels like pointing out my idiocy, here's my grammar as it > stands now: Ok, I'll take a look. At your grammar that is, not your idiocy. :) -- Jim Freeze ---------- This is the ____LAST time I take travel suggestions from Ray Bradbury!