--- parser3/src/main/compile.y 2005/11/21 09:47:35 1.213.10.5 +++ parser3/src/main/compile.y 2005/12/16 14:09:43 1.217.2.2 @@ -5,7 +5,7 @@ Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.213.10.5 2005/11/21 09:47:35 paf Exp $ + $Id: compile.y,v 1.217.2.2 2005/12/16 14:09:43 paf Exp $ */ /** @@ -48,9 +48,9 @@ static int real_yyerror(Parse_control* p static void yyprint(FILE* file, int type, YYSTYPE value); static int yylex(YYSTYPE* lvalp, void* pc); -static ArrayOperation* vlfalse=VL(new VBool(false), 0, 0, 0); -static ArrayOperation* vltrue=VL(new VBool(true), 0, 0, 0); -static ArrayOperation* vlvoid=VL(new VVoid(), 0, 0, 0); +static const VBool vfalse(false); +static const VBool vtrue(true); +static const VVoid vvoid; // local convinient inplace typecast & var #undef PC @@ -409,7 +409,7 @@ call_value: '^' { YYSTYPE params_code=$5; if(params_code->count()==4) { // probably [] case. [OP_VALUE+origin+Void+STORE_PARAM] if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value? - if(!value->is_defined()) // value is VVoid? + if(value->is_void()) // value is VVoid? params_code=0; // ^zzz[] case. don't append lone empty param. } /* stack: context, method_junction */ @@ -566,8 +566,8 @@ class_constructor_prefix: class_static_p expr_value: expr; expr: double_or_STRING -| "true" { $$ = vltrue } -| "false" { $$ = vlfalse } +| true_value +| false_value | get_value | call_value | '"' string_inside_quotes_value '"' { $$ = $2 } @@ -631,7 +631,10 @@ write_string: STRING { change_string_literal_to_write_string_literal(*($$=$1)) }; -void_value: /* empty */ { $$=vlvoid }; +void_value: /* empty */ { $$=VL(/*we know that we will not change it*/const_cast(&vvoid), 0, 0, 0) } +true_value: "true" { $$ = VL(/*we know that we will not change it*/const_cast(&vtrue), 0, 0, 0) } +false_value: "false" { $$ = VL(/*we know that we will not change it*/const_cast(&vfalse), 0, 0, 0) } + empty: /* empty */ { $$=N() }; %% @@ -755,9 +758,9 @@ default: } // #HH ? if(pc.source[0]=='#' && pc.source[1] && pc.source[2]) { - char c= + char c=(char)( hex_value[(unsigned char)pc.source[1]]*0x10+ - hex_value[(unsigned char)pc.source[2]]; + hex_value[(unsigned char)pc.source[2]]); if(c==0) { result=BAD_HEX_LITERAL; goto break2; // wrong hex value[no ^#00 chars allowed]: bail out