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
, LOCATE_syntax___SrcModuleLoader___file_type
, 31};
6 trace
.prev
= tracehead
; tracehead
= &trace
;
7 variable0
= NEW_string___String___with_native(BOX_NativeString("nit"), TAG_Int(3)); /*new String*/
9 return_label0
: while(false);
10 tracehead
= trace
.prev
;
13 val_t
syntax___SrcModuleLoader___parse_file(val_t self
, val_t param0
, val_t param1
, val_t param2
, val_t param3
, val_t param4
) {
14 struct trace_t trace
= {NULL
, LOCATE_syntax___SrcModuleLoader___parse_file
, 33};
35 trace
.prev
= tracehead
; tracehead
= &trace
;
41 variable6
= NEW_lexer___Lexer___init( variable1
/*file*/, variable2
/*filename*/); /*new Lexer*/
42 variable5
= variable6
;
43 variable7
= NEW_parser___Parser___init( variable5
/*lexer*/); /*new Parser*/
44 variable6
= variable7
;
45 variable8
= ((parser___Parser___parse_t
)CALL( variable6
/*parser*/,COLOR_parser___Parser___parse
))( variable6
/*parser*/) /*Parser::parse*/;
46 variable7
= variable8
;
47 variable8
= ((parser_nodes___Start___n_base_t
)CALL( variable7
/*node_tree*/,COLOR_parser_nodes___Start___n_base
))( variable7
/*node_tree*/) /*Start::n_base*/;
48 variable8
= TAG_Bool((variable8
== NIT_NULL
/*null*/) || ((variable8
!= NIT_NULL
) && ((((kernel___Object_____eqeq_t
)CALL(variable8
,COLOR_kernel___Object_____eqeq
))==kernel___Object_____eqeq
)?
(IS_EQUAL_NN(variable8
, NIT_NULL
/*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t
)CALL(variable8
,COLOR_kernel___Object_____eqeq
))(variable8
, NIT_NULL
/*null*/) /*PModule::==*/)))));
49 if (UNTAG_Bool(variable8
)) { /*if*/
50 variable9
= ((parser_nodes___Start___n_eof_t
)CALL( variable7
/*node_tree*/,COLOR_parser_nodes___Start___n_eof
))( variable7
/*node_tree*/) /*Start::n_eof*/;
51 variable8
= variable9
;
52 variable9
= TAG_Bool(( variable8
/*err*/==NIT_NULL
) || VAL_ISA( variable8
/*err*/, COLOR_PError
, ID_PError
)) /*cast PError*/;
53 if (!UNTAG_Bool(variable9
)) { fprintf(stderr
, "Assert%s failed (%s: %d)\n", "", LOCATE_syntax___SrcModuleLoader___parse_file
, 40); nit_exit(1);}
54 variable9
= NEW_string___String___init(); /*new String*/
55 variable10
= NEW_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
56 variable11
= variable10
;
57 ((string___String___append_t
)CALL(variable9
,COLOR_abstract_collection___IndexedCollection___append
))(variable9
, variable11
) /*String::append*/;
58 variable12
= ((parser_prod___Token___locate_t
)CALL( variable8
/*err*/,COLOR_parser_prod___PNode___locate
))( variable8
/*err*/) /*PError::locate*/;
59 variable13
= variable12
;
60 ((string___String___append_t
)CALL(variable9
,COLOR_abstract_collection___IndexedCollection___append
))(variable9
, variable13
) /*String::append*/;
61 variable14
= NEW_string___String___with_native(BOX_NativeString(": "), TAG_Int(2)); /*new String*/
62 variable15
= variable14
;
63 ((string___String___append_t
)CALL(variable9
,COLOR_abstract_collection___IndexedCollection___append
))(variable9
, variable15
) /*String::append*/;
64 variable16
= ((lexer___PError___message_t
)CALL( variable8
/*err*/,COLOR_lexer___PError___message
))( variable8
/*err*/) /*PError::message*/;
65 variable17
= variable16
;
66 ((string___String___append_t
)CALL(variable9
,COLOR_abstract_collection___IndexedCollection___append
))(variable9
, variable17
) /*String::append*/;
67 variable18
= NEW_string___String___with_native(BOX_NativeString(""), TAG_Int(0)); /*new String*/
68 variable19
= variable18
;
69 ((string___String___append_t
)CALL(variable9
,COLOR_abstract_collection___IndexedCollection___append
))(variable9
, variable19
) /*String::append*/;
70 ((mmloader___ToolContext___error_t
)CALL( variable0
/*context*/,COLOR_mmloader___ToolContext___error
))( variable0
/*context*/, variable9
) /*ToolContext::error*/;
71 exit(UNTAG_Int( TAG_Int(1)));
73 variable9
= ((parser_nodes___Start___n_base_t
)CALL( variable7
/*node_tree*/,COLOR_parser_nodes___Start___n_base
))( variable7
/*node_tree*/) /*Start::n_base*/;
74 variable8
= variable9
;
75 variable9
= TAG_Bool(( variable8
/*node_module*/==NIT_NULL
) || VAL_ISA( variable8
/*node_module*/, COLOR_AModule
, ID_AModule
)) /*cast AModule*/;
76 if (!UNTAG_Bool(variable9
)) { fprintf(stderr
, "Assert%s failed (%s: %d)\n", "", LOCATE_syntax___SrcModuleLoader___parse_file
, 45); nit_exit(1);}
77 variable10
= NEW_syntax_base___MMSrcModule___init( variable0
/*context*/, variable8
/*node_module*/, variable4
/*dir*/, variable3
/*name*/); /*new MMSrcModule*/
78 variable9
= variable10
;
79 variable5
= variable9
/*module*/;
81 return_label1
: while(false);
82 tracehead
= trace
.prev
;
85 void syntax___SrcModuleLoader___process_metamodel(val_t self
, val_t param0
, val_t param1
) {
86 struct trace_t trace
= {NULL
, LOCATE_syntax___SrcModuleLoader___process_metamodel
, 52};
89 trace
.prev
= tracehead
; tracehead
= &trace
;
92 ((syntax___MMSrcModule___process_supermodules_t
)CALL( variable1
/*module*/,COLOR_syntax___MMSrcModule___process_supermodules
))( variable1
/*module*/, variable0
/*context*/) /*MMSrcModule::process_supermodules*/;
93 ((syntax___MMSrcModule___process_syntax_t
)CALL( variable1
/*module*/,COLOR_syntax___MMSrcModule___process_syntax
))( variable1
/*module*/, variable0
/*context*/) /*MMSrcModule::process_syntax*/;
94 tracehead
= trace
.prev
;
97 void syntax___SrcModuleLoader___init(val_t self
, int* init_table
) {
98 struct trace_t trace
= {NULL
, LOCATE_syntax___SrcModuleLoader___init
, 58};
99 trace
.prev
= tracehead
; tracehead
= &trace
;
100 if (init_table
[VAL2OBJ( self
)->vft
[INIT_TABLE_POS_SrcModuleLoader
].i
]) return;
101 init_table
[VAL2OBJ( self
)->vft
[INIT_TABLE_POS_SrcModuleLoader
].i
] = 1;
102 tracehead
= trace
.prev
;
105 val_t
syntax___MMContext___tc(val_t self
) {
106 struct trace_t trace
= {NULL
, LOCATE_syntax___MMContext___tc
, 62};
107 trace
.prev
= tracehead
; tracehead
= &trace
;
108 tracehead
= trace
.prev
;
109 return ATTR_syntax___MMContext____tc( self
) /*MMContext::_tc*/;
111 void syntax___MMContext___tc__eq(val_t self
, val_t param0
) {
112 struct trace_t trace
= {NULL
, LOCATE_syntax___MMContext___tc__eq
, 62};
113 trace
.prev
= tracehead
; tracehead
= &trace
;
114 ATTR_syntax___MMContext____tc( self
) /*MMContext::_tc*/ = param0
;
115 tracehead
= trace
.prev
;
118 void syntax___MMSrcModule___process_supermodules(val_t self
, val_t param0
) {
119 struct trace_t trace
= {NULL
, LOCATE_syntax___MMSrcModule___process_supermodules
, 67};
122 trace
.prev
= tracehead
; tracehead
= &trace
;
124 variable1
= ((syntax_base___MMSrcModule___node_t
)CALL( self
,COLOR_syntax_base___MMSrcModule___node
))( self
) /*MMSrcModule::node*/;
125 ((mmbuilder___AModule___import_super_modules_t
)CALL(variable1
,COLOR_mmbuilder___AModule___import_super_modules
))(variable1
, variable0
/*tc*/, self
) /*AModule::import_super_modules*/;
126 tracehead
= trace
.prev
;
129 void syntax___MMSrcModule___process_syntax(val_t self
, val_t param0
) {
130 struct trace_t trace
= {NULL
, LOCATE_syntax___MMSrcModule___process_syntax
, 74};
133 trace
.prev
= tracehead
; tracehead
= &trace
;
135 ((mmbuilder___MMSrcModule___do_mmbuilder_t
)CALL( self
,COLOR_mmbuilder___MMSrcModule___do_mmbuilder
))( self
, variable0
/*tc*/) /*MMSrcModule::do_mmbuilder*/;
136 variable1
= ((mmloader___ToolContext___error_count_t
)CALL( variable0
/*tc*/,COLOR_mmloader___ToolContext___error_count
))( variable0
/*tc*/) /*ToolContext::error_count*/;
137 variable1
= TAG_Bool(UNTAG_Int(variable1
)>UNTAG_Int( TAG_Int(0)));
138 if (UNTAG_Bool(variable1
)) { /*if*/
139 exit(UNTAG_Int( TAG_Int(1)));
141 ((control_flow___MMSrcModule___do_control_flow_t
)CALL( self
,COLOR_control_flow___MMSrcModule___do_control_flow
))( self
, variable0
/*tc*/) /*MMSrcModule::do_control_flow*/;
142 variable1
= ((mmloader___ToolContext___error_count_t
)CALL( variable0
/*tc*/,COLOR_mmloader___ToolContext___error_count
))( variable0
/*tc*/) /*ToolContext::error_count*/;
143 variable1
= TAG_Bool(UNTAG_Int(variable1
)>UNTAG_Int( TAG_Int(0)));
144 if (UNTAG_Bool(variable1
)) { /*if*/
145 exit(UNTAG_Int( TAG_Int(1)));
147 ((typing___MMSrcModule___do_typing_t
)CALL( self
,COLOR_typing___MMSrcModule___do_typing
))( self
, variable0
/*tc*/) /*MMSrcModule::do_typing*/;
148 variable1
= ((mmloader___ToolContext___error_count_t
)CALL( variable0
/*tc*/,COLOR_mmloader___ToolContext___error_count
))( variable0
/*tc*/) /*ToolContext::error_count*/;
149 variable1
= TAG_Bool(UNTAG_Int(variable1
)>UNTAG_Int( TAG_Int(0)));
150 if (UNTAG_Bool(variable1
)) { /*if*/
151 exit(UNTAG_Int( TAG_Int(1)));
153 tracehead
= trace
.prev
;