diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-12-21 14:14:04 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-12-21 14:14:04 -0200 |
| commit | 27ae8432b6125a56b0bb31651de8cebc1b30353f (patch) | |
| tree | f2757ebd2a2154b4273975c4973ccbe509640c4f | |
| parent | 415ee250b5b544c91157a037a1e3c4a8f0b6cc4c (diff) | |
| download | lua-27ae8432b6125a56b0bb31651de8cebc1b30353f.tar.gz lua-27ae8432b6125a56b0bb31651de8cebc1b30353f.tar.bz2 lua-27ae8432b6125a56b0bb31651de8cebc1b30353f.zip | |
names generated by yacc (starting with "yy") are changed to start with
"luaY_", to avoid name clashes with hosts using yacc.
| -rw-r--r-- | lex.c | 19 | ||||
| -rw-r--r-- | makefile | 13 | ||||
| -rw-r--r-- | opcode.h | 4 |
3 files changed, 20 insertions, 16 deletions
| @@ -1,10 +1,9 @@ | |||
| 1 | char *rcs_lex = "$Id: lex.c,v 2.20 1995/10/25 13:05:51 roberto Exp roberto $"; | 1 | char *rcs_lex = "$Id: lex.c,v 2.21 1995/11/16 20:46:24 roberto Exp roberto $"; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | #include <ctype.h> | 4 | #include <ctype.h> |
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include <string.h> | 5 | #include <string.h> |
| 6 | #include <stdio.h> | ||
| 8 | 7 | ||
| 9 | #include "mem.h" | 8 | #include "mem.h" |
| 10 | #include "tree.h" | 9 | #include "tree.h" |
| @@ -144,7 +143,7 @@ static int read_long_string (void) | |||
| 144 | } | 143 | } |
| 145 | 144 | ||
| 146 | 145 | ||
| 147 | int yylex (void) | 146 | int luaY_lex (void) |
| 148 | { | 147 | { |
| 149 | float a; | 148 | float a; |
| 150 | static int linelasttoken = 0; | 149 | static int linelasttoken = 0; |
| @@ -176,12 +175,12 @@ int yylex (void) | |||
| 176 | *yytextLast = 0; | 175 | *yytextLast = 0; |
| 177 | if (lua_strcmp(yytext, "debug") == 0) | 176 | if (lua_strcmp(yytext, "debug") == 0) |
| 178 | { | 177 | { |
| 179 | yylval.vInt = 1; | 178 | luaY_lval.vInt = 1; |
| 180 | return DEBUG; | 179 | return DEBUG; |
| 181 | } | 180 | } |
| 182 | else if (lua_strcmp(yytext, "nodebug") == 0) | 181 | else if (lua_strcmp(yytext, "nodebug") == 0) |
| 183 | { | 182 | { |
| 184 | yylval.vInt = 0; | 183 | luaY_lval.vInt = 0; |
| 185 | return DEBUG; | 184 | return DEBUG; |
| 186 | } | 185 | } |
| 187 | return WRONGTOKEN; | 186 | return WRONGTOKEN; |
| @@ -203,7 +202,7 @@ int yylex (void) | |||
| 203 | return WRONGTOKEN; | 202 | return WRONGTOKEN; |
| 204 | save_and_next(); /* pass the second ']' */ | 203 | save_and_next(); /* pass the second ']' */ |
| 205 | *(yytextLast-2) = 0; /* erases ']]' */ | 204 | *(yytextLast-2) = 0; /* erases ']]' */ |
| 206 | yylval.vWord = luaI_findconstantbyname(yytext+2); | 205 | luaY_lval.vWord = luaI_findconstantbyname(yytext+2); |
| 207 | return STRING; | 206 | return STRING; |
| 208 | } | 207 | } |
| 209 | 208 | ||
| @@ -263,7 +262,7 @@ int yylex (void) | |||
| 263 | } | 262 | } |
| 264 | next(); /* skip the delimiter */ | 263 | next(); /* skip the delimiter */ |
| 265 | *yytextLast = 0; | 264 | *yytextLast = 0; |
| 266 | yylval.vWord = luaI_findconstantbyname(yytext); | 265 | luaY_lval.vWord = luaI_findconstantbyname(yytext); |
| 267 | return STRING; | 266 | return STRING; |
| 268 | } | 267 | } |
| 269 | 268 | ||
| @@ -286,7 +285,7 @@ int yylex (void) | |||
| 286 | *yytextLast = 0; | 285 | *yytextLast = 0; |
| 287 | res = findReserved(yytext); | 286 | res = findReserved(yytext); |
| 288 | if (res) return res; | 287 | if (res) return res; |
| 289 | yylval.pNode = lua_constcreate(yytext); | 288 | luaY_lval.pNode = lua_constcreate(yytext); |
| 290 | return NAME; | 289 | return NAME; |
| 291 | } | 290 | } |
| 292 | 291 | ||
| @@ -327,7 +326,7 @@ fraction: | |||
| 327 | ea*=ea; | 326 | ea*=ea; |
| 328 | } | 327 | } |
| 329 | } | 328 | } |
| 330 | yylval.vFloat = a; | 329 | luaY_lval.vFloat = a; |
| 331 | return NUMBER; | 330 | return NUMBER; |
| 332 | } | 331 | } |
| 333 | 332 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $Id: makefile,v 1.15 1995/10/17 18:16:58 roberto Exp roberto $ | 1 | # $Id: makefile,v 1.16 1995/11/10 17:56:06 roberto Exp roberto $ |
| 2 | 2 | ||
| 3 | #configuration | 3 | #configuration |
| 4 | 4 | ||
| @@ -47,14 +47,19 @@ lualib.a : $(LIBOBJS) | |||
| 47 | liblua.so.1.0 : lua.o | 47 | liblua.so.1.0 : lua.o |
| 48 | ld -o liblua.so.1.0 $(LUAOBJS) | 48 | ld -o liblua.so.1.0 $(LUAOBJS) |
| 49 | 49 | ||
| 50 | y.tab.c y.tab.h : lua.stx | ||
| 51 | yacc++ -d lua.stx | ||
| 50 | 52 | ||
| 51 | parser.c : lua.stx | 53 | parser.c : y.tab.c |
| 52 | yacc++ -d lua.stx ; mv -f y.tab.c parser.c ; mv -f y.tab.h parser.h | 54 | sed -e 's/yy/luaY_/g' y.tab.c > parser.c |
| 55 | |||
| 56 | parser.h : y.tab.h | ||
| 57 | sed -e 's/yy/luaY_/g' y.tab.h > parser.h | ||
| 53 | 58 | ||
| 54 | clear : | 59 | clear : |
| 55 | rcsclean | 60 | rcsclean |
| 56 | rm -f *.o | 61 | rm -f *.o |
| 57 | rm -f parser.c parser.h | 62 | rm -f parser.c parser.h y.tab.c y.tab.h |
| 58 | co lua.h lualib.h luadebug.h | 63 | co lua.h lualib.h luadebug.h |
| 59 | 64 | ||
| 60 | % : RCS/%,v | 65 | % : RCS/%,v |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** TeCGraf - PUC-Rio | 2 | ** TeCGraf - PUC-Rio |
| 3 | ** $Id: opcode.h,v 3.13 1995/10/17 11:58:41 roberto Exp roberto $ | 3 | ** $Id: opcode.h,v 3.14 1995/10/25 13:05:51 roberto Exp roberto $ |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #ifndef opcode_h | 6 | #ifndef opcode_h |
| @@ -146,7 +146,7 @@ char *lua_strdup (char *l); | |||
| 146 | 146 | ||
| 147 | void lua_setinput (Input fn); /* from "lex.c" module */ | 147 | void lua_setinput (Input fn); /* from "lex.c" module */ |
| 148 | char *lua_lasttext (void); /* from "lex.c" module */ | 148 | char *lua_lasttext (void); /* from "lex.c" module */ |
| 149 | int yylex (void); /* from "lex.c" module */ | 149 | int luaY_lex (void); /* from "lex.c" module */ |
| 150 | void lua_parse (TFunc *tf); /* from "lua.stx" module */ | 150 | void lua_parse (TFunc *tf); /* from "lua.stx" module */ |
| 151 | void luaI_codedebugline (int line); /* from "lua.stx" module */ | 151 | void luaI_codedebugline (int line); /* from "lua.stx" module */ |
| 152 | void lua_travstack (int (*fn)(Object *)); | 152 | void lua_travstack (int (*fn)(Object *)); |
