--- parser3/src/main/compile.y 2015/10/26 01:21:57 1.274 +++ parser3/src/main/compile.y 2016/05/18 22:27:28 1.276 @@ -8,7 +8,7 @@ */ -volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.274 2015/10/26 01:21:57 moko Exp $"; +volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.276 2016/05/18 22:27:28 moko Exp $"; /** @todo parser4: @@ -65,7 +65,7 @@ static const VString vempty; #ifndef DOXYGEN #define CLASS_ADD if(PC.class_add()){ \ - strncpy(PC.error, PC.cclass->name().cstr(), MAX_STRING/2); \ + strncpy(PC.error, PC.cclass->type(), MAX_STRING/2); \ strcat(PC.error, " - class is already defined"); \ YYERROR; \ } @@ -84,7 +84,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 "||" @@ -171,7 +170,7 @@ control_method: '@' STRING '\n' // creating the class VStateless_class* cclass=new VClass; PC.cclass_new=cclass; - PC.cclass_new->set_name(name); + PC.cclass_new->set_type(name.cstr()); PC.append=false; } else { strcpy(PC.error, "@" CLASS_NAME " must contain only one line with class name (contains more then one)"); @@ -186,14 +185,14 @@ control_method: '@' STRING '\n' } else if(command==BASE_NAME) { if(PC.append){ strcpy(PC.error, "can't set base while appending methods to class '"); - strncat(PC.error, PC.cclass->name().cstr(), MAX_STRING/2); + strncat(PC.error, PC.cclass->type(), MAX_STRING/2); strcat(PC.error, "'"); YYERROR; } CLASS_ADD; if(PC.cclass->base_class()) { // already changed from default? strcpy(PC.error, "class already have a base '"); - strncat(PC.error, PC.cclass->base_class()->name().cstr(), MAX_STRING/2); + strncat(PC.error, PC.cclass->base_class()->type(), MAX_STRING/2); strcat(PC.error, "'"); YYERROR; } @@ -231,7 +230,7 @@ control_method: '@' STRING '\n' if(VStateless_class* existed=PC.get_existed_class(PC.cclass_new)){ if(!PC.reuse_existed_class(existed)){ strcpy(PC.error, "can't append methods to '"); - strncat(PC.error, PC.cclass_new->name().cstr(), MAX_STRING/2); + strncat(PC.error, PC.cclass_new->type(), MAX_STRING/2); strcat(PC.error, "' - the class wasn't marked as partial"); YYERROR; } @@ -759,7 +758,7 @@ class_static_prefix: STRING ':' { $$=$1; // stack: class name string if(*LA2S(*$$) == BASE_NAME) { // pseudo BASE class if(VStateless_class* base=PC.cclass->base_class()) { - change_string_literal_value(*$$, base->name()); + change_string_literal_value(*$$, *new String(base->type())); } else { strcpy(PC.error, "no base class declared"); YYERROR; @@ -1064,13 +1063,12 @@ default: } if(pc.explicit_result && c) switch(c) { + default: + pc.string.append(c); case '\n': case ' ': case '\t': begin=pc.source; begin_pos=pc.pos; - continue; // skip it - default: - result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE; - goto break2; + continue; } break; @@ -1597,13 +1595,12 @@ default: } if(pc.explicit_result && c) switch(c) { + default: + pc.string.append(c); case '\n': case ' ': case '\t': begin=pc.source; begin_pos=pc.pos; - continue; // skip it - default: - result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE; - goto break2; + continue; } break;