c_src: regenerate with soft nullable handling
[nit.git] / c_src / syntax._sep.c
1 /* This C file is generated by NIT to compile module syntax. */
2 #include "syntax._sep.h"
3 val_t syntax___SrcModuleLoader___file_type(val_t self) {
4 struct trace_t trace = {NULL, NULL, 30, LOCATE_syntax___SrcModuleLoader___file_type};
5 static val_t once_value_1 = NIT_NULL; /* Once value for string variable[2]*/
6 val_t variable[3];
7 struct WBT_ **closurevariable = NULL;
8 trace.prev = tracehead; tracehead = &trace;
9 trace.file = LOCATE_syntax;
10 /* Register variable[0]: Local variable */
11 variable[0] = self;
12 /* Register variable[1]: Method return value and escape marker */
13 /* Register variable[2]: Once String constant */
14 if (once_value_1 != NIT_NULL) variable[2] = once_value_1;
15 else {
16 variable[2] = NEW_String_string___String___with_native(BOX_NativeString("nit"), TAG_Int(3)) /*new String*/;
17 once_value_1 = variable[2];
18 }
19 /* Register variable[2]: Result */
20 variable[1] = variable[2];
21 goto return_label0;
22 return_label0: while(false);
23 tracehead = trace.prev;
24 return variable[1];
25 }
26 val_t syntax___SrcModuleLoader___parse_file(val_t self, val_t param0, val_t param1, val_t param2, val_t param3, val_t param4) {
27 struct trace_t trace = {NULL, NULL, 32, LOCATE_syntax___SrcModuleLoader___parse_file};
28 static val_t once_value_3 = NIT_NULL; /* Once value for string variable[12]*/
29 static val_t once_value_4 = NIT_NULL; /* Once value for string variable[12]*/
30 static val_t once_value_5 = NIT_NULL; /* Once value for string variable[12]*/
31 val_t variable[13];
32 struct WBT_ **closurevariable = NULL;
33 trace.prev = tracehead; tracehead = &trace;
34 trace.file = LOCATE_syntax;
35 /* Register variable[0]: Local variable */
36 variable[0] = self;
37 /* Register variable[1]: Local variable */
38 variable[1] = param0;
39 /* Register variable[2]: Local variable */
40 variable[2] = param1;
41 /* Register variable[3]: Local variable */
42 variable[3] = param2;
43 /* Register variable[4]: Local variable */
44 variable[4] = param3;
45 /* Register variable[5]: Local variable */
46 variable[5] = param4;
47 /* Register variable[6]: Method return value and escape marker */
48 /* Register variable[7]: Local variable */
49 /* Register variable[8]: Result */
50 variable[8] = NEW_Lexer_lexer___Lexer___init( variable[2] /*file*/, variable[3] /*filename*/) /*new Lexer*/;
51 variable[7] = variable[8];
52 /* Register variable[8]: Local variable */
53 /* Register variable[9]: Result */
54 variable[9] = NEW_Parser_parser___Parser___init( variable[7] /*lexer*/) /*new Parser*/;
55 variable[8] = variable[9];
56 /* Register variable[9]: Local variable */
57 /* Register variable[10]: Result */
58 variable[10] = CALL_parser___Parser___parse( variable[8] /*parser*/)( variable[8] /*parser*/) /*Parser::parse*/;
59 variable[9] = variable[10];
60 /* Register variable[10]: Result */
61 variable[10] = CALL_parser_nodes___Start___n_base( variable[9] /*node_tree*/)( variable[9] /*node_tree*/) /*Start::n_base*/;
62 /* Register variable[10]: Result */
63 variable[10] = TAG_Bool((variable[10] == NIT_NULL /*null*/) || ((variable[10] != NIT_NULL) && ((CALL_kernel___Object_____eqeq(variable[10])==kernel___Object_____eqeq)?(IS_EQUAL_NN(variable[10], NIT_NULL /*null*/)):(UNTAG_Bool(CALL_kernel___Object_____eqeq(variable[10])(variable[10], NIT_NULL /*null*/) /*Object::==*/)))));
64 if (UNTAG_Bool(variable[10])) { /*if*/
65 /* Register variable[10]: Local variable */
66 /* Register variable[11]: Result */
67 variable[11] = CALL_parser_nodes___Start___n_eof( variable[9] /*node_tree*/)( variable[9] /*node_tree*/) /*Start::n_eof*/;
68 variable[10] = variable[11];
69 /* Register variable[11]: Result */
70 variable[11] = TAG_Bool(( variable[10] /*err*/==NIT_NULL) || VAL_ISA( variable[10] /*err*/, COLOR_PError, ID_PError)) /*cast PError*/;
71 if (!UNTAG_Bool(variable[11])) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_syntax___SrcModuleLoader___parse_file, LOCATE_syntax, 39); nit_exit(1);}
72 variable[11] = NEW_Array_array___Array___with_capacity(TAG_Int(5)) /*new Array[String]*/ /* Ensure var: Array (for super-string)*/;
73 /* Register variable[12]: Once String constant */
74 if (once_value_3 != NIT_NULL) variable[12] = once_value_3;
75 else {
76 variable[12] = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)) /*new String*/;
77 once_value_3 = variable[12];
78 }
79 /* Register variable[12]: Result */
80 /* Ensure var variable[12]: super-string element*/
81 CALL_abstract_collection___SimpleCollection___add(variable[11])(variable[11], variable[12]) /*AbstractArray::add*/;
82 /* Register variable[12]: Result */
83 variable[12] = CALL_parser_prod___PNode___locate( variable[10] /*err*/)( variable[10] /*err*/) /*Token::locate*/;
84 /* Ensure var variable[12]: super-string element*/
85 CALL_abstract_collection___SimpleCollection___add(variable[11])(variable[11], variable[12]) /*AbstractArray::add*/;
86 /* Register variable[12]: Once String constant */
87 if (once_value_4 != NIT_NULL) variable[12] = once_value_4;
88 else {
89 variable[12] = NEW_String_string___String___with_native(BOX_NativeString(": "), TAG_Int(2)) /*new String*/;
90 once_value_4 = variable[12];
91 }
92 /* Register variable[12]: Result */
93 /* Ensure var variable[12]: super-string element*/
94 CALL_abstract_collection___SimpleCollection___add(variable[11])(variable[11], variable[12]) /*AbstractArray::add*/;
95 /* Register variable[12]: Result */
96 variable[12] = CALL_lexer___PError___message( variable[10] /*err*/)( variable[10] /*err*/) /*PError::message*/;
97 /* Ensure var variable[12]: super-string element*/
98 CALL_abstract_collection___SimpleCollection___add(variable[11])(variable[11], variable[12]) /*AbstractArray::add*/;
99 /* Register variable[12]: Once String constant */
100 if (once_value_5 != NIT_NULL) variable[12] = once_value_5;
101 else {
102 variable[12] = NEW_String_string___String___with_native(BOX_NativeString(""), TAG_Int(0)) /*new String*/;
103 once_value_5 = variable[12];
104 }
105 /* Register variable[12]: Result */
106 /* Ensure var variable[12]: super-string element*/
107 CALL_abstract_collection___SimpleCollection___add(variable[11])(variable[11], variable[12]) /*AbstractArray::add*/;
108 /* Register variable[11]: Result */
109 variable[11] = CALL_string___Object___to_s(variable[11])(variable[11]) /*Object::to_s*/;
110 CALL_mmloader___ToolContext___error( variable[1] /*context*/)( variable[1] /*context*/, variable[11]) /*ToolContext::error*/;
111 exit(UNTAG_Int( TAG_Int(1)));
112 }
113 /* Register variable[10]: Local variable */
114 /* Register variable[11]: Result */
115 variable[11] = CALL_parser_nodes___Start___n_base( variable[9] /*node_tree*/)( variable[9] /*node_tree*/) /*Start::n_base*/;
116 variable[10] = variable[11];
117 /* Register variable[11]: Result */
118 variable[11] = TAG_Bool(( variable[10] /*node_module*/==NIT_NULL) || VAL_ISA( variable[10] /*node_module*/, COLOR_AModule, ID_AModule)) /*cast AModule*/;
119 if (!UNTAG_Bool(variable[11])) { fprintf(stderr, "Assert%s failed", ""); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_syntax___SrcModuleLoader___parse_file, LOCATE_syntax, 44); nit_exit(1);}
120 /* Register variable[11]: Local variable */
121 /* Register variable[12]: Result */
122 variable[12] = NEW_MMSrcModule_syntax_base___MMSrcModule___init( variable[1] /*context*/, variable[10] /*node_module*/, variable[5] /*dir*/, variable[4] /*name*/, variable[3] /*filename*/) /*new MMSrcModule*/;
123 variable[11] = variable[12];
124 variable[6] = variable[11] /*module*/;
125 goto return_label2;
126 return_label2: while(false);
127 tracehead = trace.prev;
128 return variable[6];
129 }
130 void syntax___SrcModuleLoader___process_metamodel(val_t self, val_t param0, val_t param1) {
131 struct trace_t trace = {NULL, NULL, 49, LOCATE_syntax___SrcModuleLoader___process_metamodel};
132 val_t variable[4];
133 struct WBT_ **closurevariable = NULL;
134 trace.prev = tracehead; tracehead = &trace;
135 trace.file = LOCATE_syntax;
136 /* Register variable[0]: Local variable */
137 variable[0] = self;
138 /* Register variable[1]: Local variable */
139 variable[1] = param0;
140 /* Register variable[2]: Local variable */
141 variable[2] = param1;
142 /* Register variable[3]: Method return value and escape marker */
143 CALL_syntax___MMSrcModule___process_supermodules( variable[2] /*module*/)( variable[2] /*module*/, variable[1] /*context*/) /*MMSrcModule::process_supermodules*/;
144 CALL_syntax___MMSrcModule___process_syntax( variable[2] /*module*/)( variable[2] /*module*/, variable[1] /*context*/) /*MMSrcModule::process_syntax*/;
145 return_label6: while(false);
146 tracehead = trace.prev;
147 return;
148 }
149 void syntax___SrcModuleLoader___init(val_t self, int* init_table) {
150 struct trace_t trace = {NULL, NULL, 55, LOCATE_syntax___SrcModuleLoader___init};
151 val_t variable[2];
152 struct WBT_ **closurevariable = NULL;
153 trace.prev = tracehead; tracehead = &trace;
154 trace.file = LOCATE_syntax;
155 /* Register variable[0]: Local variable */
156 variable[0] = self;
157 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_SrcModuleLoader].i]) return;
158 /* Register variable[1]: Method return value and escape marker */
159 return_label7: while(false);
160 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_SrcModuleLoader].i] = 1;
161 tracehead = trace.prev;
162 return;
163 }
164 void syntax___MMSrcModule___process_supermodules(val_t self, val_t param0) {
165 struct trace_t trace = {NULL, NULL, 59, LOCATE_syntax___MMSrcModule___process_supermodules};
166 val_t variable[4];
167 struct WBT_ **closurevariable = NULL;
168 trace.prev = tracehead; tracehead = &trace;
169 trace.file = LOCATE_syntax;
170 /* Register variable[0]: Local variable */
171 variable[0] = self;
172 /* Register variable[1]: Local variable */
173 variable[1] = param0;
174 /* Register variable[2]: Method return value and escape marker */
175 /* Register variable[3]: Result */
176 variable[3] = CALL_syntax_base___MMSrcModule___node(variable[0])(variable[0]) /*MMSrcModule::node*/;
177 CALL_mmbuilder___AModule___import_super_modules(variable[3])(variable[3], variable[1] /*tc*/, variable[0]) /*AModule::import_super_modules*/;
178 return_label8: while(false);
179 tracehead = trace.prev;
180 return;
181 }
182 void syntax___MMSrcModule___process_syntax(val_t self, val_t param0) {
183 struct trace_t trace = {NULL, NULL, 65, LOCATE_syntax___MMSrcModule___process_syntax};
184 val_t variable[4];
185 struct WBT_ **closurevariable = NULL;
186 trace.prev = tracehead; tracehead = &trace;
187 trace.file = LOCATE_syntax;
188 /* Register variable[0]: Local variable */
189 variable[0] = self;
190 /* Register variable[1]: Local variable */
191 variable[1] = param0;
192 /* Register variable[2]: Method return value and escape marker */
193 CALL_mmbuilder___MMSrcModule___do_mmbuilder(variable[0])(variable[0], variable[1] /*tc*/) /*MMSrcModule::do_mmbuilder*/;
194 /* Register variable[3]: Result */
195 variable[3] = CALL_mmloader___ToolContext___error_count( variable[1] /*tc*/)( variable[1] /*tc*/) /*ToolContext::error_count*/;
196 /* Register variable[3]: Result */
197 variable[3] = TAG_Bool(UNTAG_Int(variable[3])>UNTAG_Int( TAG_Int(0)));
198 if (UNTAG_Bool(variable[3])) { /*if*/
199 exit(UNTAG_Int( TAG_Int(1)));
200 }
201 CALL_typing___MMSrcModule___do_typing(variable[0])(variable[0], variable[1] /*tc*/) /*MMSrcModule::do_typing*/;
202 /* Register variable[3]: Result */
203 variable[3] = CALL_mmloader___ToolContext___error_count( variable[1] /*tc*/)( variable[1] /*tc*/) /*ToolContext::error_count*/;
204 /* Register variable[3]: Result */
205 variable[3] = TAG_Bool(UNTAG_Int(variable[3])>UNTAG_Int( TAG_Int(0)));
206 if (UNTAG_Bool(variable[3])) { /*if*/
207 exit(UNTAG_Int( TAG_Int(1)));
208 }
209 return_label9: while(false);
210 tracehead = trace.prev;
211 return;
212 }