MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / test_parser

Function test_parser

modules/gdscript/tests/test_gdscript.cpp:179–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179static void test_parser(const String &p_code, const String &p_script_path, const Vector<String> &p_lines) {
180 GDScriptParser parser;
181 Error err = parser.parse(p_code, p_script_path, false);
182
183 if (err != OK) {
184 const List<GDScriptParser::ParserError> &errors = parser.get_errors();
185 for (const GDScriptParser::ParserError &error : errors) {
186 print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message));
187 }
188 }
189
190 GDScriptAnalyzer analyzer(&parser);
191 err = analyzer.analyze();
192
193 if (err != OK) {
194 const List<GDScriptParser::ParserError> &errors = parser.get_errors();
195 for (const GDScriptParser::ParserError &error : errors) {
196 print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message));
197 }
198 }
199
200#ifdef TOOLS_ENABLED
201 GDScriptParser::TreePrinter printer;
202 printer.print_tree(parser);
203#endif
204}
205
206static void disassemble_function(const GDScriptFunction *p_func, const Vector<String> &p_lines) {
207 ERR_FAIL_NULL(p_func);

Callers 1

testFunction · 0.70

Calls 5

print_lineFunction · 0.85
vformatFunction · 0.85
analyzeMethod · 0.80
parseMethod · 0.45
print_treeMethod · 0.45

Tested by

no test coverage detected