--- parser3/src/main/compile.y 2004/04/06 14:15:22 1.212 +++ parser3/src/main/compile.y 2005/08/05 13:03:00 1.213.10.2 @@ -2,10 +2,10 @@ /** @file Parser: compiler(lexical parser and grammar). - Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.212 2004/04/06 14:15:22 paf Exp $ + $Id: compile.y,v 1.213.10.2 2005/08/05 13:03:00 paf Exp $ */ /** @@ -347,7 +347,7 @@ 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); + PC.explicit_result=*reinterpret_cast(&$2); } ']' { // stack: context, name $$=$3; // stack: context, name, value @@ -421,7 +421,7 @@ store_square_param: '[' { // 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); + PC.explicit_result=*reinterpret_cast(&$2); } ']' {$$=$3}; store_round_param: '(' store_expr_param_parts ')' {$$=$2}; store_curly_param: '{' store_curly_param_parts '}' {$$=$2}; @@ -505,7 +505,7 @@ 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); + PC.explicit_result=*reinterpret_cast(&$2); } ']' { $$=N(); OA(*$$, OP_OBJECT_POOL, $3); /* stack: empty write context */ @@ -551,13 +551,9 @@ class_constructor_prefix: class_static_p /* expr */ -expr_value: expr { - // see OP_PREPARE_TO_EXPRESSION!! - if(($$=$1)->count()==2) // only one string literal in there? - change_string_literal_to_double_literal(*$$); // make that string literal Double -}; +expr_value: expr; expr: - STRING + double_or_STRING | get_value | call_value | '"' string_inside_quotes_value '"' { $$ = $2; } @@ -602,6 +598,11 @@ expr: | expr "is" expr { $$=$1; P(*$$, *$3); O(*$$, OP_IS) } ; +double_or_STRING: STRING { + // optimized from OP_STRING->OP_VALUE for doubles + maybe_change_string_literal_to_double_literal(*($$=$1)); +}; + string_inside_quotes_value: maybe_codes { $$=N(); OA(*$$, OP_STRING_POOL, $1); /* stack: empty write context */