--- parser3/src/main/compile.y 2007/10/25 10:52:48 1.222 +++ parser3/src/main/compile.y 2008/06/10 14:06:00 1.224 @@ -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.222 2007/10/25 10:52:48 misha Exp $ + $Id: compile.y,v 1.224 2008/06/10 14:06:00 misha Exp $ */ /** @@ -41,6 +41,7 @@ // defines #define USE_CONTROL_METHOD_NAME "USE" +#define OPTIONS_CONTROL_METHOD_NAME "OPTION" // forwards @@ -150,12 +151,14 @@ control_method: '@' STRING '\n' YYERROR; } if(command==CLASS_NAME) { + /* if(PC.cclass->base_class()) { // already changed from default? strcpy(PC.error, "class already have a name '"); strncat(PC.error, PC.cclass->name().cstr(), 100); strcat(PC.error, "'"); YYERROR; } + */ if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) { // new class' name const String& name=*LA2S(*strings_code); @@ -165,6 +168,7 @@ control_method: '@' STRING '\n' PC.cclass->set_name(name); // append to request's classes PC.request.classes().put(name, cclass); + *PC.cclasses+=cclass; } else { strcpy(PC.error, "@"CLASS_NAME" must contain only one line with class name (contains more then one)"); YYERROR; @@ -203,11 +207,22 @@ control_method: '@' STRING '\n' strcpy(PC.error, "@"BASE_NAME" must contain sole name"); YYERROR; } + } else if(command==OPTIONS_CONTROL_METHOD_NAME) { + for(size_t i=0; icount(); i+=OPERATIONS_PER_OPVALUE) { + const String& option=*LA2S(*strings_code, i); + if(option==ALL_VARS_LOCAL_NAME){ + PC.cclass->all_vars_local(); + } else { + strcpy(PC.error, option.cstr()); + strcat(PC.error, ": unknown option in @"OPTIONS_CONTROL_METHOD_NAME" was specified."); + YYERROR; + } + } } else { strcpy(PC.error, "'"); strncat(PC.error, command.cstr(), MAX_STRING/2); strcat(PC.error, "' invalid special name. valid names are " - "'"CLASS_NAME"', '"USE_CONTROL_METHOD_NAME"' and '"BASE_NAME"'"); + "'"CLASS_NAME"', '"USE_CONTROL_METHOD_NAME"', '"BASE_NAME"' and '"OPTIONS_CONTROL_METHOD_NAME"'."); YYERROR; } }; @@ -229,23 +244,29 @@ code_method: '@' STRING bracketed_maybe_ YYSTYPE locals_names_code=$4; ArrayString* locals_names=0; + bool all_vars_local=false; if(int size=locals_names_code->count()) { locals_names=new ArrayString; for(int i=0; iis_vars_local()){ + all_vars_local=true; + } Method* method=new Method( //name, Method::CT_ANY, 0, 0/*min,max numbered_params_count*/, params_names, locals_names, - 0/*to be filled later in next {} */, 0); + 0/*to be filled later in next {} */, 0, all_vars_local); *reinterpret_cast(&$$)=method;