help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very simple program with error


From: Hans Aberg
Subject: Re: Very simple program with error
Date: Sat, 5 Apr 2008 19:13:24 +0200

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]