added support for ugly tokens
This commit is contained in:
51
lex.c
51
lex.c
@@ -1,5 +1,8 @@
|
|||||||
char *rcs_lex = "$Id: lex.c,v 2.3 1994/08/17 17:41:50 celes Exp celes $";
|
char *rcs_lex = "$Id: lex.c,v 2.4 1994/09/05 19:14:40 celes Exp lhf $";
|
||||||
/*$Log: lex.c,v $
|
/*$Log: lex.c,v $
|
||||||
|
* Revision 2.4 1994/09/05 19:14:40 celes
|
||||||
|
* escapes \' e \" em strings; correcao do escape \\
|
||||||
|
*
|
||||||
* Revision 2.3 1994/08/17 17:41:50 celes
|
* Revision 2.3 1994/08/17 17:41:50 celes
|
||||||
* Implementacao da macro 'lua_strcmp'
|
* Implementacao da macro 'lua_strcmp'
|
||||||
*
|
*
|
||||||
@@ -82,6 +85,30 @@ static struct
|
|||||||
{"until", UNTIL},
|
{"until", UNTIL},
|
||||||
{"while", WHILE} };
|
{"while", WHILE} };
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
U_and=128,
|
||||||
|
U_do,
|
||||||
|
U_else,
|
||||||
|
U_elseif,
|
||||||
|
U_end,
|
||||||
|
U_function,
|
||||||
|
U_if,
|
||||||
|
U_local,
|
||||||
|
U_nil,
|
||||||
|
U_not,
|
||||||
|
U_or,
|
||||||
|
U_repeat,
|
||||||
|
U_return,
|
||||||
|
U_then,
|
||||||
|
U_until,
|
||||||
|
U_while,
|
||||||
|
U_le = '<'+128,
|
||||||
|
U_ge = '>'+128,
|
||||||
|
U_ne = '~'+128,
|
||||||
|
U_sc = '.'+128
|
||||||
|
};
|
||||||
|
|
||||||
#define RESERVEDSIZE (sizeof(reserved)/sizeof(reserved[0]))
|
#define RESERVEDSIZE (sizeof(reserved)/sizeof(reserved[0]))
|
||||||
|
|
||||||
|
|
||||||
@@ -241,6 +268,27 @@ fraction: while (isdigit(current)) save_and_next();
|
|||||||
yylval.vFloat = atof(yytext[currentText]);
|
yylval.vFloat = atof(yytext[currentText]);
|
||||||
return NUMBER;
|
return NUMBER;
|
||||||
|
|
||||||
|
case U_and: return AND;
|
||||||
|
case U_do: return DO;
|
||||||
|
case U_else: return ELSE;
|
||||||
|
case U_elseif: return ELSEIF;
|
||||||
|
case U_end: return END;
|
||||||
|
case U_function: return FUNCTION;
|
||||||
|
case U_if: return IF;
|
||||||
|
case U_local: return LOCAL;
|
||||||
|
case U_nil: return NIL;
|
||||||
|
case U_not: return NOT;
|
||||||
|
case U_or: return OR;
|
||||||
|
case U_repeat: return REPEAT;
|
||||||
|
case U_return: return RETURN;
|
||||||
|
case U_then: return THEN;
|
||||||
|
case U_until: return UNTIL;
|
||||||
|
case U_while: return WHILE;
|
||||||
|
case U_le: return LE;
|
||||||
|
case U_ge: return GE;
|
||||||
|
case U_ne: return NE;
|
||||||
|
case U_sc: return CONC;
|
||||||
|
|
||||||
default: /* also end of file */
|
default: /* also end of file */
|
||||||
{
|
{
|
||||||
save_and_next();
|
save_and_next();
|
||||||
@@ -249,4 +297,3 @@ fraction: while (isdigit(current)) save_and_next();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user