From 0624540eef9d348392c926024797e582b7e6e2cf Mon Sep 17 00:00:00 2001 From: Waldemar Celes Date: Wed, 17 Aug 1994 14:41:50 -0300 Subject: Implementacao da macro 'lua_strcmp' --- lex.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lex.c') diff --git a/lex.c b/lex.c index c7c7bed6..379e4427 100644 --- a/lex.c +++ b/lex.c @@ -1,5 +1,9 @@ -char *rcs_lex = "$Id: lex.c,v 2.1 1994/04/15 19:00:28 celes Exp celes $"; +char *rcs_lex = "$Id: lex.c,v 2.2 1994/08/05 19:27:41 celes Exp celes $"; /*$Log: lex.c,v $ + * Revision 2.2 1994/08/05 19:27:41 celes + * implementacao de dois buffer de 'yytext' para evitar bug + * no look ahead do yacc + * * Revision 2.1 1994/04/15 19:00:28 celes * Retirar chamada da funcao lua_findsymbol associada a cada * token NAME. A decisao de chamar lua_findsymbol ou lua_findconstant @@ -26,6 +30,8 @@ char *rcs_lex = "$Id: lex.c,v 2.1 1994/04/15 19:00:28 celes Exp celes $"; #include "table.h" #include "y.tab.h" +#define lua_strcmp(a,b) (a[0]b[0]?(1):strcmp(a,b))) + #define next() { current = input(); } #define save(x) { *yytextLast++ = (x); } #define save_and_next() { save(current); next(); } @@ -83,7 +89,7 @@ static int findReserved (char *name) while (l <= h) { int m = (l+h)/2; - int comp = strcmp(name, reserved[m].name); + int comp = lua_strcmp(name, reserved[m].name); if (comp < 0) h = m-1; else if (comp == 0) @@ -114,12 +120,12 @@ int yylex () while (isalnum(current) || current == '_') save_and_next(); *yytextLast = 0; - if (strcmp(yytext[currentText], "debug") == 0) + if (lua_strcmp(yytext[currentText], "debug") == 0) { yylval.vInt = 1; return DEBUG; } - else if (strcmp(yytext[currentText], "nodebug") == 0) + else if (lua_strcmp(yytext[currentText], "nodebug") == 0) { yylval.vInt = 0; return DEBUG; -- cgit v1.2.3-55-g6feb