--- parser3/src/main/compile.y 2016/04/01 16:27:31 1.275 +++ parser3/src/main/compile.y 2016/05/24 16:38:40 1.280 @@ -8,7 +8,7 @@ */ -volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.275 2016/04/01 16:27:31 moko Exp $"; +volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.280 2016/05/24 16:38:40 moko Exp $"; /** @todo parser4: @@ -41,11 +41,9 @@ volatile const char * IDENT_COMPILE_Y = // defines +#define CLASS_NAME "CLASS" #define USE_CONTROL_METHOD_NAME "USE" #define OPTIONS_CONTROL_METHOD_NAME "OPTIONS" -#define OPTION_ALL_VARS_LOCAL_NAME "locals" -#define OPTION_PARTIAL_CLASS "partial" -#define REM_OPERATOR_NAME "rem" // forwards @@ -84,7 +82,6 @@ static const VString vempty; %token BAD_HEX_LITERAL %token BAD_METHOD_DECL_START %token BAD_METHOD_PARAMETER_NAME_CHARACTER -%token BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE %token LAND "&&" %token LOR "||" @@ -224,9 +221,9 @@ control_method: '@' STRING '\n' } else if(command==OPTIONS_CONTROL_METHOD_NAME) { for(size_t i=0; icount(); i+=OPERATIONS_PER_OPVALUE) { const String& option=LA2S(*strings_code, i)->trim(String::TRIM_END); - if(option==OPTION_ALL_VARS_LOCAL_NAME){ + if(option==Symbols::LOCALS_SYMBOL){ PC.set_all_vars_local(); - } else if(option==OPTION_PARTIAL_CLASS){ + } else if(option==Symbols::PARTIAL_SYMBOL){ if(PC.cclass_new){ if(VStateless_class* existed=PC.get_existed_class(PC.cclass_new)){ if(!PC.reuse_existed_class(existed)){ @@ -240,20 +237,17 @@ control_method: '@' STRING '\n' PC.cclass_new->set_partial(); } } else { - strcpy(PC.error, "'" OPTION_PARTIAL_CLASS "' option should be used straight after @" CLASS_NAME); + strcpy(PC.error, "'partial' option should be used straight after @" CLASS_NAME); YYERROR; } - } else if(option==method_call_type_static){ + } else if(option==Symbols::STATIC_SYMBOL){ PC.set_methods_call_type(Method::CT_STATIC); - } else if(option==method_call_type_dynamic){ + } else if(option==Symbols::DYNAMIC_SYMBOL){ PC.set_methods_call_type(Method::CT_DYNAMIC); } else { strcpy(PC.error, "'"); strncat(PC.error, option.cstr(), MAX_STRING/2); - strcat(PC.error, "' invalid option. valid options are " - "'" OPTION_PARTIAL_CLASS "', '" OPTION_ALL_VARS_LOCAL_NAME "'" - ", '" METHOD_CALL_TYPE_STATIC "' and '" METHOD_CALL_TYPE_DYNAMIC "'" - ); + strcat(PC.error, "' invalid option. valid options are 'partial', 'locals', 'static' and 'dynamic'"); YYERROR; } } @@ -289,9 +283,9 @@ code_method: '@' STRING bracketed_maybe_ locals_names=new ArrayString; for(int i=0; iget(pc.string); +#else + Value *lookup=0; +#endif *lvalp=VL( - new VString(*new String(pc.string, String::L_CLEAN)), - pc.file_no, pc.string_start.line, pc.string_start.col); + lookup ? lookup : new VString(*new String(pc.string, String::L_CLEAN)), pc.file_no, pc.string_start.line, pc.string_start.col); // new pieces storage pc.string.clear(); pc.string_start.clear();