[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wrong value on a type
From: |
Akim Demaille |
Subject: |
Re: Wrong value on a type |
Date: |
19 Jan 2001 18:07:54 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Crater Lake) |
My bet is that it is your scanner which is wrong. Make sure it uses
(allocates for instance) a different space for each string. The
typical error would be
/my_pattern/ { yylval = yytext; return STRING; }
in a Lex scanner, as yytext *belong to Lex* which does whatever it
wants with it. Roughly (but still not perfect), write
/my_pattern/ { yylval = strdup (yytext); return STRING; }
For the fun, try to display the addresses instead of the contents:
fparmitem : typed IDENTIFIER
{
printf ("$1 = %p, $2 = %p\n", $1, $2);
}
I wouldn't be surprised that $2 points inside $1.