--- parser3/src/main/compile.y 2015/04/08 18:08:52 1.270 +++ parser3/src/main/compile.y 2015/09/28 22:26:13 1.272 @@ -8,7 +8,7 @@ */ -volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.270 2015/04/08 18:08:52 moko Exp $"; +volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.272 2015/09/28 22:26:13 moko Exp $"; /** @todo parser4: @@ -22,11 +22,9 @@ volatile const char * IDENT_COMPILE_Y = */ #define YYSTYPE ArrayOperation* -#define YYPARSE_PARAM pc -#define YYLEX_PARAM pc #define YYDEBUG 1 -#define YYERROR_VERBOSE 1 -#define yyerror(msg) real_yyerror((Parse_control *)pc, msg) +#define YYERROR_VERBOSE 1 +#define yyerror(pc, msg) real_yyerror(pc, msg) #define YYPRINT(file, type, value) yyprint(file, type, value) #define YYMALLOC pa_malloc #define YYFREE pa_free @@ -61,7 +59,7 @@ static const VString vempty; // local convinient inplace typecast & var #undef PC -#define PC (*(Parse_control *)pc) +#define PC (*pc) #undef POOL #define POOL (*PC.pool) #ifndef DOXYGEN @@ -74,7 +72,9 @@ static const VString vempty; %} -%pure_parser +%pure-parser +%lex-param {Parse_control* pc} +%parse-param {Parse_control* pc} %token EON %token STRING @@ -586,7 +586,11 @@ call_value: '^' { && (*var_code)[0].code==OP::OP_VALUE__GET_CLASS && (*var_code)[3].code==OP::OP_PREPARE_TO_CONSTRUCT_OBJECT && (*var_code)[4].code==OP::OP_VALUE +#ifdef FEATURE_GET_ELEMENT4CALL + && (*var_code)[7].code==OP::OP_GET_ELEMENT4CALL +#else && (*var_code)[7].code==OP::OP_GET_ELEMENT +#endif ){ $$=N(); O(*$$, OP::OP_CONSTRUCT_OBJECT); @@ -601,7 +605,21 @@ call_value: '^' { } }; -call_name: name_without_curly_rdive; +call_name: name_without_curly_rdive { +#ifdef FEATURE_GET_ELEMENT4CALL + size_t count=$1->count(); + if(count){ + $$=$1; +#ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT + !(count==5 && change_first(*$$, OP::OP_GET_OBJECT_ELEMENT, OP::OP_GET_OBJECT_ELEMENT4CALL)) && +#endif +#ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT + !(count==5 && change_first(*$$, OP::OP_GET_OBJECT_VAR_ELEMENT, OP::OP_GET_OBJECT_VAR_ELEMENT4CALL)) && +#endif + !change(*$$, count-1, OP::OP_GET_ELEMENT, OP::OP_GET_ELEMENT4CALL); + } +#endif +}; store_params: store_param | store_params store_param { $$=$1; P(*$$, *$2); }; store_param: