--- parser3/src/main/compile.y 2001/03/25 10:14:39 1.115 +++ parser3/src/main/compile.y 2001/03/27 14:51:29 1.119 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.115 2001/03/25 10:14:39 paf Exp $ + $Id: compile.y,v 1.119 2001/03/27 14:51:29 paf Exp $ */ /** @@ -31,6 +31,7 @@ #include "pa_config_includes.h" #include #include +#include #include "compile_tools.h" #include "pa_value.h" @@ -359,6 +360,10 @@ store_square_param: '[' store_code_param store_round_param: '(' store_expr_param_parts ')' {$$=$2}; store_curly_param: '{' store_curly_param_parts '}' {$$=$2}; store_code_param_parts: + empty /* optimized [] case */ +| store_code_param_parts_not_empty +; +store_code_param_parts_not_empty: store_code_param_part | store_code_param_parts ';' store_code_param_part { $$=$1; P($$, $3) } ; @@ -371,8 +376,7 @@ store_curly_param_parts: | store_curly_param_parts ';' store_curly_param_part { $$=$1; P($$, $3) } ; store_code_param_part: - empty /* optimized [] case */ -| STRING { /* optimized [STRING] case */ + STRING { /* optimized [STRING] case */ $$=$1; O($$, OP_STORE_PARAM); } @@ -570,7 +574,7 @@ static int yylex(YYSTYPE *lvalp, void *p } else PC.col++; - if(c=='^') + if(c=='^' && PC.ls!=LS_COMMENT && PC.ls!=LS_DEF_COMMENT) switch(*PC.source) { // escaping: ^^ ^$ ^; ^) ^} ^( ^{ ^" case '^': case '$': case ';': @@ -785,33 +789,33 @@ static int yylex(YYSTYPE *lvalp, void *p RC; case 'l': case 'g': case 'e': case 'n': if(end==begin) // right after whitespace - switch(*PC.source) { -// case '?': // ok [and bad cases, yacc would bark at them] - case 't': // lt gt [et nt] - result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR; - skip_analized=1; - goto break2; - case 'e': // le ge ne [ee] - result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR; - skip_analized=1; - goto break2; - case 'q': // eq [lq gq nq] - result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR; - skip_analized=1; - goto break2; + if(isspace(PC.source[1])) { + switch(*PC.source) { + // case '?': // ok [and bad cases, yacc would bark at them] + case 't': // lt gt [et nt] + result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR; + skip_analized=1; + goto break2; + case 'e': // le ge ne [ee] + result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR; + skip_analized=1; + goto break2; + case 'q': // eq [lq gq nq] + result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR; + skip_analized=1; + goto break2; + } } break; case 'i': if(end==begin) // right after whitespace - switch(PC.source[0]) { - case 'n': - { // in + if(isspace(PC.source[1])) { + switch(PC.source[0]) { + case 'n': // in skip_analized=1; result=IN; goto break2; - } - case 's': - { // is + case 's': // is skip_analized=1; result=IS; goto break2;