--- parser3/src/main/compile.y 2001/02/24 08:43:52 1.30 +++ parser3/src/main/compile.y 2001/02/24 09:31:34 1.32 @@ -1,5 +1,5 @@ /* - $Id: compile.y,v 1.30 2001/02/24 08:43:52 paf Exp $ + $Id: compile.y,v 1.32 2001/02/24 09:31:34 paf Exp $ */ %{ @@ -201,16 +201,26 @@ call: '^' name_without_curly_rdive store store_params: store_param | store_params store_param { $$=$1; P($$, $2) }; store_param: store_round_param | store_curly_param; store_round_param: '(' store_param_parts ')' {$$=$2}; -store_param_parts: store_param_part | store_param_parts ';' store_param_part { $$=$1; P($$, $3) }; -store_param_part: constructor_one_param_value { - $$=$1; - OP($$, OP_STORE_PARAM); -} +store_param_parts: + store_param_part +| store_param_parts ';' store_param_part { $$=$1; P($$, $3) } +; store_curly_param: '{' maybe_codes '}' { $$=N(POOL); PCA($$, $2); OP($$, OP_STORE_PARAM); }; +store_param_part: + empty /* optimized $var() case */ +| STRING { /* optimized $var(STRING) case */ + $$=$1; + OP($$, OP_STORE_PARAM); +} +| complex_constructor_param_value { /* $var(something complex) */ + $$=$1; + OP($$, OP_STORE_PARAM); +} +; /* name */ @@ -286,10 +296,7 @@ write_str_literal: STRING { $$=N(POOL); } }; -empty_value: empty { - $$=$1; - PVS($$, NEW VString(POOL)); -}; +empty_value: /* empty */ { $$=L(NEW VString(POOL)) }; empty: /* empty */ { $$=N(POOL) }; %% @@ -433,7 +440,7 @@ int yylex(YYSTYPE *lvalp, void *pc) { c==' '|| c=='\t' || c=='\n' || c==')' || c=='}') { pop_LS(PC); - PC->source--; PC->col--; + PC->source--; if(--PC->col<0) { PC->line--; PC->col=-1; } result=EON; goto break2; } @@ -601,13 +608,12 @@ int yylex(YYSTYPE *lvalp, void *pc) { goto break2; } pop_LS(PC); - PC->source--; PC->col--; + PC->source--; if(--PC->col<0) { PC->line--; PC->col=-1; } result=EON; goto break2; } if(c==0) { result=-1; -// PC->source--; PC->col--; break; } }