Subject: Re: yacc bug? or me?
To: None <prlw1@cam.ac.uk>
From: Rob Quinn <rquinn@sprint.net>
List: current-users
Date: 03/05/2001 15:33:48
 I haven't done this for a while, but I think you need to copy the string
pointed to by yytext, and not the pointer itself.

> [a-zA-Z]{3}	{
> 		  yylval=yytext;

 For instance, I changed this to yylval=strdup(yytext) and then it worked as
you expected:

%./lexprob 
scan: |dog|
scan: |cat|
gram: |dog| !cat!
scan: |one|
scan: |two|
gram: |one| !two!

 You'll also need to put in some garbage collection, to recover the allocated
strings.