--- parser3/src/main/compile.y 2001/03/06 12:00:44 1.48 +++ parser3/src/main/compile.y 2001/03/06 12:57:30 1.50 @@ -1,5 +1,5 @@ /* - $Id: compile.y,v 1.48 2001/03/06 12:00:44 paf Exp $ + $Id: compile.y,v 1.50 2001/03/06 12:57:30 paf Exp $ */ %{ @@ -40,6 +40,7 @@ int yylex(YYSTYPE *lvalp, void *pc); %token EON %token STRING %token BOGUS +%token LOGICAL_AND LOGICAL_OR %% @@ -215,11 +216,6 @@ name_expr_wdive_root: ':' name_expr_dive name_expr_wdive_class: class_prefix name_expr_dive_code { $$=$1; P($$, $2) }; constructor_value: - constructor_one_param_value -| constructor_two_params_value /* $var(=;2*2) $var(%d;2*2) $var(+;1) */ -; - -constructor_one_param_value: empty_value /* optimized $var() case */ | STRING /* optimized $var(STRING) case */ | complex_constructor_param_value /* $var(something complex) */ @@ -233,25 +229,6 @@ complex_constructor_param_value: complex complex_constructor_param_body: codes__excluding_sole_str_literal; codes__excluding_sole_str_literal: action | code codes { $$=$1; P($$, $2) }; -constructor_two_params_value: STRING ';' constructor_one_param_value { - char *operator_or_fmt=SLA2S($1)->cstr(); - $$=N(POOL); - P($$, $1); /* stack: ncontext name operator_or_fmt */ - P($$, $3); /* stack: ncontext name operator_or_fmt expr */ - switch(operator_or_fmt[0]) { - case '=': case '%': - OP($$, OP_EXPRESSION_EVAL); - break; - case '+': case '-': case '*': case '/': - OP($$, OP_MODIFY_EVAL); - break; - default: - strcpy(PC->error, "invalid modification operator"); - YYERROR; - } - /* stack: ncontext name value */ -}; - /* call */ call: '^' call_name store_params EON { /* ^field.$method{vasya} */ @@ -411,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') { @@ -435,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; } @@ -493,7 +470,7 @@ int yylex(YYSTYPE *lvalp, void *pc) { case ']': PC->ls=*PC->source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT; RC; - case c=='\n': // wrong. bailing out + case '\n': // wrong. bailing out pop_LS(PC); RC; } @@ -548,25 +525,33 @@ int yylex(YYSTYPE *lvalp, void *pc) { lexical_brackets_nestage++; RC; case '+': case '-': case '*': case '/': case '%': - case ';': RC; case '&': case '|': + if(*PC->source==c) { // && || + result=c=='&'?LOGICAL_AND:LOGICAL_OR; + PC->source++; PC->col++; + } else + result=c; + goto break2; case '<': case '>': case '=': case '!': - ? - break; + case ';': + RC; case '"': push_LS(PC, LS_EXPRESSION_STRING); RC; + case 'l': case 'g': case 'e': case 'n': + if(end==begin) { + case(*PC->source) { + } + } 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; }