Always return null-terminated identifiers from yylex().

This commit is contained in:
Bruce Evans 1995-02-16 11:52:11 +00:00
parent 829b9f6e93
commit 5cea80f170
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6494

View File

@ -35,6 +35,7 @@
*/
#include <ctype.h>
#include <string.h>
#include "y.tab.h"
#include "config.h"
@ -117,7 +118,7 @@ WORD [A-Za-z_][-A-Za-z_]*
if ((i = kw_lookup(yytext)) == -1)
{
yylval.str = yytext;
yylval.str = strdup(yytext);
tprintf("id(%s) ", yytext);
return ID;
}
@ -126,7 +127,7 @@ WORD [A-Za-z_][-A-Za-z_]*
}
\"[^"]+\" {
yytext[strlen(yytext)-1] = '\0';
yylval.str = yytext + 1;
yylval.str = strdup(yytext + 1);
return ID;
}
0[0-7]* {