|
From: | Hans Aberg |
Subject: | Re: token extraction problem within a rule |
Date: | Thu, 8 Nov 2007 13:44:38 +0100 |
On 8 Nov 2007, at 10:49, Richard Gill wrote:
I started learning flex/bison some days ago to write a parser. Nearly all my parser works well, but I've a problem with a rule which matches well but gives a wrong result in $n. I checked the lexer (flex) did extract right token.
There is a quite common newbie error to not copy the token that the Flex generated lexer points. It just points to a buffer, temporarily '\0' terminated, and changed back. Bison then makes several calls, and if given just a pointer in the buffer, there will be some jumble.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |