names generated by yacc (starting with "yy") are changed to start with

"luaY_", to avoid name clashes with hosts using yacc.
This commit is contained in:
Roberto Ierusalimschy 1995-12-21 14:14:04 -02:00
parent 415ee250b5
commit 27ae8432b6
3 changed files with 20 additions and 16 deletions

19
lex.c
View File

@ -1,10 +1,9 @@
char *rcs_lex = "$Id: lex.c,v 2.20 1995/10/25 13:05:51 roberto Exp roberto $";
char *rcs_lex = "$Id: lex.c,v 2.21 1995/11/16 20:46:24 roberto Exp roberto $";
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "mem.h"
#include "tree.h"
@ -144,7 +143,7 @@ static int read_long_string (void)
}
int yylex (void)
int luaY_lex (void)
{
float a;
static int linelasttoken = 0;
@ -176,12 +175,12 @@ int yylex (void)
*yytextLast = 0;
if (lua_strcmp(yytext, "debug") == 0)
{
yylval.vInt = 1;
luaY_lval.vInt = 1;
return DEBUG;
}
else if (lua_strcmp(yytext, "nodebug") == 0)
{
yylval.vInt = 0;
luaY_lval.vInt = 0;
return DEBUG;
}
return WRONGTOKEN;
@ -203,7 +202,7 @@ int yylex (void)
return WRONGTOKEN;
save_and_next(); /* pass the second ']' */
*(yytextLast-2) = 0; /* erases ']]' */
yylval.vWord = luaI_findconstantbyname(yytext+2);
luaY_lval.vWord = luaI_findconstantbyname(yytext+2);
return STRING;
}
@ -263,7 +262,7 @@ int yylex (void)
}
next(); /* skip the delimiter */
*yytextLast = 0;
yylval.vWord = luaI_findconstantbyname(yytext);
luaY_lval.vWord = luaI_findconstantbyname(yytext);
return STRING;
}
@ -286,7 +285,7 @@ int yylex (void)
*yytextLast = 0;
res = findReserved(yytext);
if (res) return res;
yylval.pNode = lua_constcreate(yytext);
luaY_lval.pNode = lua_constcreate(yytext);
return NAME;
}
@ -327,7 +326,7 @@ fraction:
ea*=ea;
}
}
yylval.vFloat = a;
luaY_lval.vFloat = a;
return NUMBER;
}

View File

@ -1,4 +1,4 @@
# $Id: makefile,v 1.15 1995/10/17 18:16:58 roberto Exp roberto $
# $Id: makefile,v 1.16 1995/11/10 17:56:06 roberto Exp roberto $
#configuration
@ -47,14 +47,19 @@ lualib.a : $(LIBOBJS)
liblua.so.1.0 : lua.o
ld -o liblua.so.1.0 $(LUAOBJS)
y.tab.c y.tab.h : lua.stx
yacc++ -d lua.stx
parser.c : lua.stx
yacc++ -d lua.stx ; mv -f y.tab.c parser.c ; mv -f y.tab.h parser.h
parser.c : y.tab.c
sed -e 's/yy/luaY_/g' y.tab.c > parser.c
parser.h : y.tab.h
sed -e 's/yy/luaY_/g' y.tab.h > parser.h
clear :
rcsclean
rm -f *.o
rm -f parser.c parser.h
rm -f parser.c parser.h y.tab.c y.tab.h
co lua.h lualib.h luadebug.h
% : RCS/%,v

View File

@ -1,6 +1,6 @@
/*
** TeCGraf - PUC-Rio
** $Id: opcode.h,v 3.13 1995/10/17 11:58:41 roberto Exp roberto $
** $Id: opcode.h,v 3.14 1995/10/25 13:05:51 roberto Exp roberto $
*/
#ifndef opcode_h
@ -146,7 +146,7 @@ char *lua_strdup (char *l);
void lua_setinput (Input fn); /* from "lex.c" module */
char *lua_lasttext (void); /* from "lex.c" module */
int yylex (void); /* from "lex.c" module */
int luaY_lex (void); /* from "lex.c" module */
void lua_parse (TFunc *tf); /* from "lua.stx" module */
void luaI_codedebugline (int line); /* from "lua.stx" module */
void lua_travstack (int (*fn)(Object *));