--- parser3/src/main/compile.y 2004/04/06 14:08:41 1.210 +++ parser3/src/main/compile.y 2004/04/06 14:15:22 1.212 @@ -5,7 +5,7 @@ Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.210 2004/04/06 14:08:41 paf Exp $ + $Id: compile.y,v 1.212 2004/04/06 14:15:22 paf Exp $ */ /** @@ -343,9 +343,14 @@ construct: | construct_round | construct_curly ; -construct_square: '[' any_constructor_code_value ']' { +construct_square: '[' { + // allow $result_or_other_variable[ letters here any time ] + *reinterpret_cast(&$$)=PC.explicit_result; PC.explicit_result=false; +} any_constructor_code_value { + PC.explicit_result=reinterpret_cast($2); +} ']' { // stack: context, name - $$=$2; // stack: context, name, value + $$=$3; // stack: context, name, value O(*$$, OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */ } ; @@ -413,7 +418,7 @@ store_param: | store_curly_param ; store_square_param: '[' { - // allow ^call[ whitespace here any time ] + // allow ^call[ letters here any time ] *reinterpret_cast(&$$)=PC.explicit_result; PC.explicit_result=false; } store_code_param_parts { PC.explicit_result=reinterpret_cast($2); @@ -496,9 +501,14 @@ name_expr_with_subvar_value: STRING subv $$=N(); OA(*$$, OP_STRING_POOL, code); }; -name_square_code_value: '[' codes ']' { +name_square_code_value: '[' { + // allow $result_or_other_variable[ letters here any time ] + *reinterpret_cast(&$$)=PC.explicit_result; PC.explicit_result=false; +} codes { + PC.explicit_result=reinterpret_cast($2); +} ']' { $$=N(); - OA(*$$, OP_OBJECT_POOL, $2); /* stack: empty write context */ + OA(*$$, OP_OBJECT_POOL, $3); /* stack: empty write context */ /* some code that writes to that context */ /* context=pop; stack: context.value() */ };