commit 0624540eef9d348392c926024797e582b7e6e2cf
parent a4eeb099c8be2ca2608bfec7232da878549288f0
Author: Waldemar Celes <celes@tecgraf.puc-rio.br>
Date: Wed, 17 Aug 1994 14:41:31 -0300
Implementacao da macro 'lua_strcmp'
Diffstat:
M | lex.c | | | 14 | ++++++++++---- |
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git 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):(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;