|
|
| version 1.81.2.9, 2003/02/24 16:28:08 | version 1.81.2.13.2.5, 2003/03/20 14:19:09 |
|---|---|
| Line 82 static int yylex(YYSTYPE *lvalp, void *p | Line 82 static int yylex(YYSTYPE *lvalp, void *p |
| // local convinient inplace typecast & var | // local convinient inplace typecast & var |
| #undef PC | |
| #define PC (*(parse_control *)pc) | #define PC (*(parse_control *)pc) |
| #undef POOL | |
| #define POOL (*PC.pool) | #define POOL (*PC.pool) |
| #undef NEW | |
| #define NEW new(POOL) | |
| #ifndef DOXYGEN | #ifndef DOXYGEN |
| #ifndef YYSTYPE | #ifndef YYSTYPE |
| #define YYSTYPE int | #define YYSTYPE int |
| Line 232 static const short yyrline[] = { 0, | Line 232 static const short yyrline[] = { 0, |
| #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) |
| static const char * const yytname[] = { "$","error","$undefined.","EON","STRING", | static const char* const yytname[] = { "$","error","$undefined.","EON","STRING", |
| "BOGUS","BAD_STRING_COMPARISON_OPERATOR","BAD_HEX_LITERAL","BAD_METHOD_DECL_START", | "BOGUS","BAD_STRING_COMPARISON_OPERATOR","BAD_HEX_LITERAL","BAD_METHOD_DECL_START", |
| "BAD_METHOD_PARAMETER_NAME_CHARACTER","BAD_MATH_OPERATOR_CHARACTER","\"&&\"", | "BAD_METHOD_PARAMETER_NAME_CHARACTER","BAD_MATH_OPERATOR_CHARACTER","\"&&\"", |
| "\"||\"","\"!||\"","\"!|\"","\"<=\"","\">=\"","\"==\"","\"!=\"","\"<<\"","\">>\"", | "\"||\"","\"!||\"","\"!|\"","\"<=\"","\">=\"","\"==\"","\"!=\"","\"<<\"","\">>\"", |
| Line 1036 case 1: | Line 1036 case 1: |
| { | { |
| MethodPtr method(new Method(main_method_name, Method::CT_ANY, | MethodPtr method(new Method(main_method_name, Method::CT_ANY, |
| 0, 0, /*min, max numbered_params_count*/ | 0, 0, /*min, max numbered_params_count*/ |
| ArrayStringPtr(0)/*param_names*/, ArrayStringPtr(0)/*local_names*/, | Array0/*param_names*/, Array0/*local_names*/, |
| yyvsp[0]/*parser_code*/, 0/*native_code*/)); | yyvsp[0]/*parser_code*/, 0/*native_code*/)); |
| PC.cclass->add_method(main_method_name, method); | PC.cclass->add_method(main_method_name, method); |
| ; | ; |
| Line 1044 case 1: | Line 1044 case 1: |
| case 8: | case 8: |
| #line 131 "compile.y" | #line 131 "compile.y" |
| { | { |
| StringPtr command=LA2S(*yyvsp[-2]); | const String& command=LA2S(*yyvsp[-2]); |
| YYSTYPE strings_code=yyvsp[0]; | YYSTYPE strings_code=yyvsp[0]; |
| if(strings_code->count()<1*2) { | if(strings_code->count()<1*2) { |
| strcpy(PC.error, "@"); | strcpy(PC.error, "@"); |
| Line 1061 case 8: | Line 1061 case 8: |
| } | } |
| if(strings_code->count()==1*2) { | if(strings_code->count()==1*2) { |
| // new class' name | // new class' name |
| StringPtr name=LA2S(*strings_code); | const String& name=LA2S(*strings_code); |
| // creating the class | // creating the class |
| VStateless_classPtr cclass(new VClass); | VStateless_classPtr cclass(new VClass); cclass->set_name(name); |
| PC.cclass=cclass.get(); | |
| PC.cclass->set_name(name); | |
| // append to request's classes | // append to request's classes |
| PC.request->classes().put(name, cclass); | PC.request->classes().put(name, cclass); |
| // new methods go to that class | |
| PC.cclass=cclass.get(); | |
| } else { | } else { |
| strcpy(PC.error, "@"CLASS_NAME" must contain sole name"); | strcpy(PC.error, "@"CLASS_NAME" must contain sole name"); |
| YYERROR; | YYERROR; |
| Line 1083 case 8: | Line 1083 case 8: |
| YYERROR; | YYERROR; |
| } | } |
| if(strings_code->count()==1*2) { | if(strings_code->count()==1*2) { |
| StringPtr base_name=LA2S(*strings_code); | const String& base_name=LA2S(*strings_code); |
| if(ValuePtr base_class_value=PC.request->classes().get(base_name)) { | if(ValuePtr base_class_value=PC.request->classes().get(base_name)) { |
| // @CLASS == @BASE sanity check | // @CLASS == @BASE sanity check |
| if(VStateless_class *base_class=base_class_value->get_class()) { | if(VStateless_class *base_class=base_class_value->get_class()) { |
| Line 1122 case 12: | Line 1122 case 12: |
| case 16: | case 16: |
| #line 208 "compile.y" | #line 208 "compile.y" |
| { | { |
| StringPtr name=LA2S(*yyvsp[-5]); | const String& name=LA2S(*yyvsp[-5]); |
| YYSTYPE params_names_code=yyvsp[-4]; | YYSTYPE params_names_code=yyvsp[-4]; |
| ArrayStringPtr params_names; | ArrayString& params_names; |
| if(int size=params_names_code->count()) { | if(int size=params_names_code->count()) { |
| params_names=ArrayStringPtr(new ArrayString); | params_names=ArrayString* (new ArrayString); |
| for(int i=0; i<size; i+=2) | for(int i=0; i<size; i+=2) |
| *params_names+=LA2S(*params_names_code, i); | *params_names+=LA2S(*params_names_code, i); |
| } | } |
| YYSTYPE locals_names_code=yyvsp[-3]; | YYSTYPE locals_names_code=yyvsp[-3]; |
| ArrayStringPtr locals_names; | ArrayString& locals_names; |
| if(int size=locals_names_code->count()) { | if(int size=locals_names_code->count()) { |
| locals_names=ArrayStringPtr(new ArrayString); | locals_names=ArrayString* (new ArrayString); |
| for(int i=0; i<size; i+=2) | for(int i=0; i<size; i+=2) |
| *locals_names+=LA2S(*locals_names_code, i); | *locals_names+=LA2S(*locals_names_code, i); |
| } | } |
| Line 1184 case 42: | Line 1184 case 42: |
| { | { |
| yyval=N(); | yyval=N(); |
| ArrayOperationPtr diving_code=yyvsp[0]; | ArrayOperationPtr diving_code=yyvsp[0]; |
| StringPtr first_name=LA2S(*diving_code); | const String& first_name=LA2S(*diving_code); |
| // self.xxx... -> xxx... | // self.xxx... -> xxx... |
| // OP_VALUE+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+... | // OP_VALUE+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+... |
| if(first_name && *first_name==SELF_ELEMENT_NAME) { | if(first_name && *first_name==SELF_ELEMENT_NAME) { |
| Line 1224 case 50: | Line 1224 case 50: |
| { | { |
| yyval=N(); | yyval=N(); |
| ArrayOperationPtr diving_code=yyvsp[0]; | ArrayOperationPtr diving_code=yyvsp[0]; |
| StringPtr first_name=LA2S(*diving_code); | const String& first_name=LA2S(*diving_code); |
| // $self.xxx... -> $xxx... | // $self.xxx... -> $xxx... |
| // OP_VALUE+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+... | // OP_VALUE+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+... |
| if(first_name && *first_name==SELF_ELEMENT_NAME) { | if(first_name && *first_name==SELF_ELEMENT_NAME) { |
| Line 1281 case 62: | Line 1281 case 62: |
| #line 355 "compile.y" | #line 355 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */ | OA(*yyval, OP_OBJECT_yyvsp[0]); /* stack: empty write context */ |
| /* some code that writes to that context */ | /* some code that writes to that context */ |
| /* context=pop; stack: context.value() */ | /* context=pop; stack: context.value() */ |
| ; | ; |
| Line 1427 case 105: | Line 1427 case 105: |
| P(*code, *yyvsp[0]); | P(*code, *yyvsp[0]); |
| } | } |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP_STRING_POOL, code); | OA(*yyval, OP_STRING_code); |
| ; | ; |
| break;} | break;} |
| case 106: | case 106: |
| #line 478 "compile.y" | #line 478 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP_OBJECT_POOL, yyvsp[-1]); /* stack: empty write context */ | OA(*yyval, OP_OBJECT_yyvsp[-1]); /* stack: empty write context */ |
| /* some code that writes to that context */ | /* some code that writes to that context */ |
| /* context=pop; stack: context.value() */ | /* context=pop; stack: context.value() */ |
| ; | ; |
| Line 1648 case 157: | Line 1648 case 157: |
| #line 574 "compile.y" | #line 574 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP_STRING_POOL, yyvsp[0]); /* stack: empty write context */ | OA(*yyval, OP_STRING_yyvsp[0]); /* stack: empty write context */ |
| /* some code that writes to that context */ | /* some code that writes to that context */ |
| /* context=pop; stack: context.get_string() */ | /* context=pop; stack: context.get_string() */ |
| ; | ; |
| Line 1923 static int yylex(YYSTYPE *lvalp, void *p | Line 1923 static int yylex(YYSTYPE *lvalp, void *p |
| return result; | return result; |
| } | } |
| const char *begin=PC.source; | const char* begin=PC.source; |
| const char *end; | const char* end; |
| int begin_line=PC.line; | int begin_line=PC.line; |
| int skip_analized=0; | int skip_analized=0; |
| while(true) { | while(true) { |
| Line 2603 break2: | Line 2603 break2: |
| PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line/*, start_col*/); | PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line/*, start_col*/); |
| } | } |
| } | } |
| if(PC.string->size()) { // something accumulated? | if(PC.string->length()) { // something accumulated? |
| // create STRING value: array of OP_VALUE+vstring | // create STRING value: array of OP_VALUE+vstring |
| *lvalp=VL(ValuePtr(new VString(PC.string))); | *lvalp=VL(ValuePtr(new VString(PC.string))); |
| // new pieces storage | // new pieces storage |
| PC.string=StringPtr(new String); | PC.string=String* (new String); |
| // make current result be pending for next call, return STRING for now | // make current result be pending for next call, return STRING for now |
| PC.pending_state=result; result=STRING; | PC.pending_state=result; result=STRING; |
| } | } |