Closed alexschneider closed 9 years ago
If you have an infinite loop in your parser, then the way to debug it is to print out the token each time you call match()
. It will show you where you are getting stuck. Also maybe print out the name of the parsing function you are entering.
Actually looking at it, match doesn't look like it always consumes a token - specifically if there's an error. I'm 99% sure I fixed this, so perhaps a merge reverted it and I didn't catch it.
These things appear occasionally, but I managed to get this string of tokens (it's invalid, but shouldn't cause any sort of issue like this) to do so consistently. I spent about 45 minutes debugging and wasn't able to figure it out - perhaps someone else sees something I don't.
Maybe we could add a check to all of our
while
loops to make sure that after every iteration, it did some work. I suspect that that's where our issue is from - either that or there is some path in parseExpression that doesn't consume any tokens that just keeps getting run through when it hits the right thing.Tokens: