On 5 Apr 2008, at 17:20, Rodrigo Bagni wrote:
When I print the "atom" variable at the end of the parser, its content
is "Example; end"
but I want it to be only "Example" because it is the last identifier I got.

Is it something wrong with my rule? Can someone help, please?

The Flex generated lexer just provide a pointer of the token to a buffer, temporarily terminated by a '\0'. So if you do not copy the string before handling to the Bison generated parser, the token will change when the lexer it called the next time. And in your rule, the lexer is called several times.

  Hans Aberg





_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to