From 70b1eb4e8b478da4c12dba591218a5c8597bd727 Mon Sep 17 00:00:00 2001 From: Waldemar Celes Date: Wed, 22 Dec 1993 19:39:15 -0200 Subject: [PATCH] Tratamento do token $debug e $nodebug --- lex.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/lex.c b/lex.c index 81bf9f31..1c36f7ac 100644 --- a/lex.c +++ b/lex.c @@ -1,5 +1,8 @@ -char *rcs_lex = "$Id$"; -/*$Log$*/ +char *rcs_lex = "$Id: lex.c,v 1.1 1993/12/22 21:15:16 roberto Exp celes $"; +/*$Log: lex.c,v $ + * Revision 1.1 1993/12/22 21:15:16 roberto + * Initial revision + **/ #include #include @@ -84,17 +87,33 @@ int yylex () yytextLast = yytext; switch (current) { - case 0: return 0; case '\n': lua_linenumber++; case ' ': case '\t': - save_and_next(); + next(); continue; + + case '$': + next(); + while (isalnum(current) || current == '_') + save_and_next(); + *yytextLast = 0; + if (strcmp(yytext, "debug") == 0) + { + yylval.vInt = 1; + return DEBUG; + } + else if (strcmp(yytext, "nodebug") == 0) + { + yylval.vInt = 0; + return DEBUG; + } + return WRONGTOKEN; case '-': save_and_next(); if (current != '-') return '-'; - do { save_and_next(); } while (current != '\n' && current != 0); + do { next(); } while (current != '\n' && current != 0); continue; case '<': @@ -195,11 +214,10 @@ fraction: while (isdigit(current)) save_and_next(); yylval.vFloat = atof(yytext); return NUMBER; - default: + default: /* also end of file */ { - int temp = current; save_and_next(); - return temp; + return *yytext; } } }