--- parser3/src/main/compile.y 2001/03/06 12:22:58 1.49 +++ parser3/src/main/compile.y 2001/03/06 13:07:03 1.51 @@ -1,5 +1,5 @@ /* - $Id: compile.y,v 1.49 2001/03/06 12:22:58 paf Exp $ + $Id: compile.y,v 1.51 2001/03/06 13:07:03 paf Exp $ */ %{ @@ -40,6 +40,7 @@ int yylex(YYSTYPE *lvalp, void *pc); %token EON %token STRING %token BOGUS +%token LOGICAL_AND LOGICAL_OR %% @@ -387,7 +388,7 @@ int yylex(YYSTYPE *lvalp, void *pc) { char *begin=PC->source; char *end; int begin_line=PC->line; - while(1) { + while(true) { c=*(end=(PC->source++)); if(c=='\n') { @@ -411,7 +412,7 @@ int yylex(YYSTYPE *lvalp, void *pc) { begin=PC->source; // ^ begin_line=PC->line; // skip over ^ and _ - PC->source++; + PC->source++; PC->col++; // skip analysis = forced literal continue; } @@ -531,16 +532,25 @@ int yylex(YYSTYPE *lvalp, void *pc) { case '"': push_LS(PC, LS_EXPRESSION_STRING); RC; + case 'l': case 'g': case 'e': case 'n': + if(end==begin) // right after whitespace + switch(char next_c=*PC->source) { +// case '?': // ok [and bad cases, yacc would bark at them] + case 't': // lt gt [et nt] + case 'e': // le ge ne [ee] + case 'q': // eq [lq gq nq] + PC->source++; PC->col++; + PC->pending_state=next_c; + return c; + } break; case ' ': case '\t': case '\n': if(end!=begin) { // append piece till whitespace PC->string->APPEND(begin, end-begin, PC->file, begin_line); } - // skip over whitespace - PC->source++; // reset piece 'start' position & line - begin=PC->source; // ^ + begin=PC->source; // after whitespace begin_line=PC->line; continue; }