gdscript_extend_parser.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. /*************************************************************************/
  2. /* gdscript_extend_parser.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "gdscript_extend_parser.h"
  31. #include "../gdscript.h"
  32. #include "core/io/json.h"
  33. #include "gdscript_language_protocol.h"
  34. #include "gdscript_workspace.h"
  35. void ExtendGDScriptParser::update_diagnostics() {
  36. diagnostics.clear();
  37. if (has_error()) {
  38. lsp::Diagnostic diagnostic;
  39. diagnostic.severity = lsp::DiagnosticSeverity::Error;
  40. diagnostic.message = get_error();
  41. diagnostic.source = "gdscript";
  42. diagnostic.code = -1;
  43. lsp::Range range;
  44. lsp::Position pos;
  45. int line = LINE_NUMBER_TO_INDEX(get_error_line());
  46. const String &line_text = get_lines()[line];
  47. pos.line = line;
  48. pos.character = line_text.length() - line_text.strip_edges(true, false).length();
  49. range.start = pos;
  50. range.end = range.start;
  51. range.end.character = line_text.strip_edges(false).length();
  52. diagnostic.range = range;
  53. diagnostics.push_back(diagnostic);
  54. }
  55. const List<GDScriptWarning> &warnings = get_warnings();
  56. for (const List<GDScriptWarning>::Element *E = warnings.front(); E; E = E->next()) {
  57. const GDScriptWarning &warning = E->get();
  58. lsp::Diagnostic diagnostic;
  59. diagnostic.severity = lsp::DiagnosticSeverity::Warning;
  60. diagnostic.message = warning.get_message();
  61. diagnostic.source = "gdscript";
  62. diagnostic.code = warning.code;
  63. lsp::Range range;
  64. lsp::Position pos;
  65. int line = LINE_NUMBER_TO_INDEX(warning.line);
  66. const String &line_text = get_lines()[line];
  67. pos.line = line;
  68. pos.character = line_text.length() - line_text.strip_edges(true, false).length();
  69. range.start = pos;
  70. range.end = pos;
  71. range.end.character = line_text.strip_edges(false).length();
  72. diagnostic.range = range;
  73. diagnostics.push_back(diagnostic);
  74. }
  75. }
  76. void ExtendGDScriptParser::update_symbols() {
  77. members.clear();
  78. const GDScriptParser::Node *head = get_parse_tree();
  79. if (const GDScriptParser::ClassNode *gdclass = dynamic_cast<const GDScriptParser::ClassNode *>(head)) {
  80. parse_class_symbol(gdclass, class_symbol);
  81. for (int i = 0; i < class_symbol.children.size(); i++) {
  82. const lsp::DocumentSymbol &symbol = class_symbol.children[i];
  83. members.set(symbol.name, &symbol);
  84. // cache level one inner classes
  85. if (symbol.kind == lsp::SymbolKind::Class) {
  86. ClassMembers inner_class;
  87. for (int j = 0; j < symbol.children.size(); j++) {
  88. const lsp::DocumentSymbol &s = symbol.children[j];
  89. inner_class.set(s.name, &s);
  90. }
  91. inner_classes.set(symbol.name, inner_class);
  92. }
  93. }
  94. }
  95. }
  96. void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p_class, lsp::DocumentSymbol &r_symbol) {
  97. const String uri = get_uri();
  98. r_symbol.uri = uri;
  99. r_symbol.script_path = path;
  100. r_symbol.children.clear();
  101. r_symbol.name = p_class->name;
  102. if (r_symbol.name.empty())
  103. r_symbol.name = path.get_file();
  104. r_symbol.kind = lsp::SymbolKind::Class;
  105. r_symbol.deprecated = false;
  106. r_symbol.range.start.line = LINE_NUMBER_TO_INDEX(p_class->line);
  107. r_symbol.range.start.character = p_class->column;
  108. r_symbol.range.end.line = LINE_NUMBER_TO_INDEX(p_class->end_line);
  109. r_symbol.selectionRange.start.line = r_symbol.range.start.line;
  110. r_symbol.detail = "class " + r_symbol.name;
  111. bool is_root_class = &r_symbol == &class_symbol;
  112. r_symbol.documentation = parse_documentation(is_root_class ? 0 : LINE_NUMBER_TO_INDEX(p_class->line), is_root_class);
  113. for (int i = 0; i < p_class->variables.size(); ++i) {
  114. const GDScriptParser::ClassNode::Member &m = p_class->variables[i];
  115. lsp::DocumentSymbol symbol;
  116. symbol.name = m.identifier;
  117. symbol.kind = lsp::SymbolKind::Variable;
  118. symbol.deprecated = false;
  119. const int line = LINE_NUMBER_TO_INDEX(m.line);
  120. symbol.range.start.line = line;
  121. symbol.range.start.character = lines[line].length() - lines[line].strip_edges(true, false).length();
  122. symbol.range.end.line = line;
  123. symbol.range.end.character = lines[line].length();
  124. symbol.selectionRange.start.line = symbol.range.start.line;
  125. symbol.detail = "var " + m.identifier;
  126. if (m.data_type.kind != GDScriptParser::DataType::UNRESOLVED) {
  127. symbol.detail += ": " + m.data_type.to_string();
  128. }
  129. if (m.default_value.get_type() != Variant::NIL) {
  130. symbol.detail += " = " + JSON::print(m.default_value);
  131. }
  132. symbol.documentation = parse_documentation(line);
  133. symbol.uri = uri;
  134. symbol.script_path = path;
  135. r_symbol.children.push_back(symbol);
  136. }
  137. for (int i = 0; i < p_class->_signals.size(); ++i) {
  138. const GDScriptParser::ClassNode::Signal &signal = p_class->_signals[i];
  139. lsp::DocumentSymbol symbol;
  140. symbol.name = signal.name;
  141. symbol.kind = lsp::SymbolKind::Event;
  142. symbol.deprecated = false;
  143. const int line = LINE_NUMBER_TO_INDEX(signal.line);
  144. symbol.range.start.line = line;
  145. symbol.range.start.character = lines[line].length() - lines[line].strip_edges(true, false).length();
  146. symbol.range.end.line = symbol.range.start.line;
  147. symbol.range.end.character = lines[line].length();
  148. symbol.selectionRange.start.line = symbol.range.start.line;
  149. symbol.documentation = parse_documentation(line);
  150. symbol.uri = uri;
  151. symbol.script_path = path;
  152. symbol.detail = "signal " + signal.name + "(";
  153. for (int j = 0; j < signal.arguments.size(); j++) {
  154. if (j > 0) {
  155. symbol.detail += ", ";
  156. }
  157. symbol.detail += signal.arguments[j];
  158. }
  159. symbol.detail += ")";
  160. r_symbol.children.push_back(symbol);
  161. }
  162. for (Map<StringName, GDScriptParser::ClassNode::Constant>::Element *E = p_class->constant_expressions.front(); E; E = E->next()) {
  163. lsp::DocumentSymbol symbol;
  164. const GDScriptParser::ClassNode::Constant &c = E->value();
  165. const GDScriptParser::ConstantNode *node = dynamic_cast<const GDScriptParser::ConstantNode *>(c.expression);
  166. symbol.name = E->key();
  167. symbol.kind = lsp::SymbolKind::Constant;
  168. symbol.deprecated = false;
  169. const int line = LINE_NUMBER_TO_INDEX(E->get().expression->line);
  170. symbol.range.start.line = line;
  171. symbol.range.start.character = E->get().expression->column;
  172. symbol.range.end.line = symbol.range.start.line;
  173. symbol.range.end.character = lines[line].length();
  174. symbol.selectionRange.start.line = symbol.range.start.line;
  175. symbol.documentation = parse_documentation(line);
  176. symbol.uri = uri;
  177. symbol.script_path = path;
  178. symbol.detail = "const " + symbol.name;
  179. if (c.type.kind != GDScriptParser::DataType::UNRESOLVED) {
  180. symbol.detail += ": " + c.type.to_string();
  181. }
  182. String value_text;
  183. if (node->value.get_type() == Variant::OBJECT) {
  184. RES res = node->value;
  185. if (res.is_valid() && !res->get_path().empty()) {
  186. value_text = "preload(\"" + res->get_path() + "\")";
  187. if (symbol.documentation.empty()) {
  188. if (Map<String, ExtendGDScriptParser *>::Element *S = GDScriptLanguageProtocol::get_singleton()->get_workspace().scripts.find(res->get_path())) {
  189. symbol.documentation = S->get()->class_symbol.documentation;
  190. }
  191. }
  192. } else {
  193. value_text = JSON::print(node->value);
  194. }
  195. } else {
  196. value_text = JSON::print(node->value);
  197. }
  198. if (!value_text.empty()) {
  199. symbol.detail += " = " + value_text;
  200. }
  201. r_symbol.children.push_back(symbol);
  202. }
  203. for (int i = 0; i < p_class->functions.size(); ++i) {
  204. const GDScriptParser::FunctionNode *func = p_class->functions[i];
  205. lsp::DocumentSymbol symbol;
  206. parse_function_symbol(func, symbol);
  207. r_symbol.children.push_back(symbol);
  208. }
  209. for (int i = 0; i < p_class->static_functions.size(); ++i) {
  210. const GDScriptParser::FunctionNode *func = p_class->static_functions[i];
  211. lsp::DocumentSymbol symbol;
  212. parse_function_symbol(func, symbol);
  213. r_symbol.children.push_back(symbol);
  214. }
  215. for (int i = 0; i < p_class->subclasses.size(); ++i) {
  216. const GDScriptParser::ClassNode *subclass = p_class->subclasses[i];
  217. lsp::DocumentSymbol symbol;
  218. parse_class_symbol(subclass, symbol);
  219. r_symbol.children.push_back(symbol);
  220. }
  221. }
  222. void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionNode *p_func, lsp::DocumentSymbol &r_symbol) {
  223. const String uri = get_uri();
  224. r_symbol.name = p_func->name;
  225. r_symbol.kind = lsp::SymbolKind::Function;
  226. r_symbol.detail = "func " + p_func->name + "(";
  227. r_symbol.deprecated = false;
  228. const int line = LINE_NUMBER_TO_INDEX(p_func->line);
  229. r_symbol.range.start.line = line;
  230. r_symbol.range.start.character = p_func->column;
  231. r_symbol.range.end.line = MAX(p_func->body->end_line - 2, p_func->body->line);
  232. r_symbol.range.end.character = lines[r_symbol.range.end.line].length();
  233. r_symbol.selectionRange.start.line = r_symbol.range.start.line;
  234. r_symbol.documentation = GDScriptWorkspace::marked_documentation(parse_documentation(line));
  235. r_symbol.uri = uri;
  236. r_symbol.script_path = path;
  237. String arguments;
  238. for (int i = 0; i < p_func->arguments.size(); i++) {
  239. lsp::DocumentSymbol symbol;
  240. symbol.kind = lsp::SymbolKind::Variable;
  241. symbol.name = p_func->arguments[i];
  242. symbol.range.start.line = LINE_NUMBER_TO_INDEX(p_func->body->line);
  243. symbol.range.start.character = p_func->body->column;
  244. symbol.range.end = symbol.range.start;
  245. symbol.uri = uri;
  246. symbol.script_path = path;
  247. r_symbol.children.push_back(symbol);
  248. if (i > 0) {
  249. arguments += ", ";
  250. }
  251. arguments += String(p_func->arguments[i]);
  252. if (p_func->argument_types[i].kind != GDScriptParser::DataType::UNRESOLVED) {
  253. arguments += ": " + p_func->argument_types[i].to_string();
  254. }
  255. int default_value_idx = i - (p_func->arguments.size() - p_func->default_values.size());
  256. if (default_value_idx >= 0) {
  257. const GDScriptParser::ConstantNode *const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(p_func->default_values[default_value_idx]);
  258. if (const_node == NULL) {
  259. const GDScriptParser::OperatorNode *operator_node = dynamic_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[default_value_idx]);
  260. if (operator_node) {
  261. const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(operator_node->next);
  262. }
  263. }
  264. if (const_node) {
  265. String value = JSON::print(const_node->value);
  266. arguments += " = " + value;
  267. }
  268. }
  269. }
  270. r_symbol.detail += arguments + ")";
  271. if (p_func->return_type.kind != GDScriptParser::DataType::UNRESOLVED) {
  272. r_symbol.detail += " -> " + p_func->return_type.to_string();
  273. }
  274. for (const Map<StringName, LocalVarNode *>::Element *E = p_func->body->variables.front(); E; E = E->next()) {
  275. lsp::DocumentSymbol symbol;
  276. const GDScriptParser::LocalVarNode *var = E->value();
  277. symbol.name = E->key();
  278. symbol.kind = lsp::SymbolKind::Variable;
  279. symbol.range.start.line = LINE_NUMBER_TO_INDEX(E->get()->line);
  280. symbol.range.start.character = E->get()->column;
  281. symbol.range.end.line = symbol.range.start.line;
  282. symbol.range.end.character = lines[symbol.range.end.line].length();
  283. symbol.uri = uri;
  284. symbol.script_path = path;
  285. symbol.detail = "var " + symbol.name;
  286. if (var->datatype.kind != GDScriptParser::DataType::UNRESOLVED) {
  287. symbol.detail += ": " + var->datatype.to_string();
  288. }
  289. symbol.documentation = GDScriptWorkspace::marked_documentation(parse_documentation(line));
  290. r_symbol.children.push_back(symbol);
  291. }
  292. }
  293. String ExtendGDScriptParser::parse_documentation(int p_line, bool p_docs_down) {
  294. ERR_FAIL_INDEX_V(p_line, lines.size(), String());
  295. List<String> doc_lines;
  296. if (!p_docs_down) { // inline comment
  297. String inline_comment = lines[p_line];
  298. int comment_start = inline_comment.find("#");
  299. if (comment_start != -1) {
  300. inline_comment = inline_comment.substr(comment_start, inline_comment.length());
  301. if (inline_comment.length() > 1) {
  302. doc_lines.push_back(inline_comment.substr(1, inline_comment.length()));
  303. }
  304. }
  305. }
  306. int step = p_docs_down ? 1 : -1;
  307. int start_line = p_docs_down ? p_line : p_line - 1;
  308. for (int i = start_line; true; i += step) {
  309. if (i < 0 || i >= lines.size()) break;
  310. String line_comment = lines[i].strip_edges(true, false);
  311. if (line_comment.begins_with("#")) {
  312. if (line_comment.length() > 1) {
  313. line_comment = line_comment.substr(1, line_comment.length());
  314. if (p_docs_down) {
  315. doc_lines.push_back(line_comment);
  316. } else {
  317. doc_lines.push_front(line_comment);
  318. }
  319. } else {
  320. if (p_docs_down) {
  321. doc_lines.push_back("");
  322. } else {
  323. doc_lines.push_front("");
  324. }
  325. }
  326. } else {
  327. break;
  328. }
  329. }
  330. String doc;
  331. for (List<String>::Element *E = doc_lines.front(); E; E = E->next()) {
  332. String content = E->get();
  333. doc += content + "\n";
  334. }
  335. return doc;
  336. }
  337. String ExtendGDScriptParser::get_text_for_completion(const lsp::Position &p_cursor) const {
  338. String longthing;
  339. int len = lines.size();
  340. for (int i = 0; i < len; i++) {
  341. if (i == p_cursor.line) {
  342. longthing += lines[i].substr(0, p_cursor.character);
  343. longthing += String::chr(0xFFFF); //not unicode, represents the cursor
  344. longthing += lines[i].substr(p_cursor.character, lines[i].size());
  345. } else {
  346. longthing += lines[i];
  347. }
  348. if (i != len - 1)
  349. longthing += "\n";
  350. }
  351. return longthing;
  352. }
  353. String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_cursor, const String &p_symbol, bool p_func_requred) const {
  354. String longthing;
  355. int len = lines.size();
  356. for (int i = 0; i < len; i++) {
  357. if (i == p_cursor.line) {
  358. String line = lines[i];
  359. String first_part = line.substr(0, p_cursor.character);
  360. String last_part = line.substr(p_cursor.character, lines[i].size());
  361. if (!p_symbol.empty()) {
  362. String left_cursor_text;
  363. for (int c = p_cursor.character - 1; c >= 0; c--) {
  364. left_cursor_text = line.substr(c, p_cursor.character - c);
  365. if (p_symbol.begins_with(left_cursor_text)) {
  366. first_part = line.substr(0, c);
  367. first_part += p_symbol;
  368. break;
  369. }
  370. }
  371. }
  372. longthing += first_part;
  373. longthing += String::chr(0xFFFF); //not unicode, represents the cursor
  374. if (p_func_requred) {
  375. longthing += "("; // tell the parser this is a function call
  376. }
  377. longthing += last_part;
  378. } else {
  379. longthing += lines[i];
  380. }
  381. if (i != len - 1)
  382. longthing += "\n";
  383. }
  384. return longthing;
  385. }
  386. String ExtendGDScriptParser::get_identifier_under_position(const lsp::Position &p_position, Vector2i &p_offset) const {
  387. ERR_FAIL_INDEX_V(p_position.line, lines.size(), "");
  388. String line = lines[p_position.line];
  389. ERR_FAIL_INDEX_V(p_position.character, line.size(), "");
  390. int start_pos = p_position.character;
  391. for (int c = p_position.character; c >= 0; c--) {
  392. start_pos = c;
  393. CharType ch = line[c];
  394. bool valid_char = (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_';
  395. if (!valid_char) {
  396. break;
  397. }
  398. }
  399. int end_pos = p_position.character;
  400. for (int c = p_position.character; c < line.length(); c++) {
  401. CharType ch = line[c];
  402. bool valid_char = (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_';
  403. if (!valid_char) {
  404. break;
  405. }
  406. end_pos = c;
  407. }
  408. if (start_pos < end_pos) {
  409. p_offset.x = start_pos - p_position.character;
  410. p_offset.y = end_pos - p_position.character;
  411. return line.substr(start_pos + 1, end_pos - start_pos);
  412. }
  413. return "";
  414. }
  415. String ExtendGDScriptParser::get_uri() const {
  416. return GDScriptLanguageProtocol::get_singleton()->get_workspace().get_file_uri(path);
  417. }
  418. const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent) const {
  419. const lsp::DocumentSymbol *ret = NULL;
  420. if (p_line < p_parent.range.start.line) {
  421. return ret;
  422. } else if (p_parent.range.start.line == p_line) {
  423. return &p_parent;
  424. } else {
  425. for (int i = 0; i < p_parent.children.size(); i++) {
  426. ret = search_symbol_defined_at_line(p_line, p_parent.children[i]);
  427. if (ret) {
  428. break;
  429. }
  430. }
  431. }
  432. return ret;
  433. }
  434. const lsp::DocumentSymbol *ExtendGDScriptParser::get_symbol_defined_at_line(int p_line) const {
  435. if (p_line <= 0) {
  436. return &class_symbol;
  437. }
  438. return search_symbol_defined_at_line(p_line, class_symbol);
  439. }
  440. const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String &p_name, const String &p_subclass) const {
  441. if (p_subclass.empty()) {
  442. const lsp::DocumentSymbol *const *ptr = members.getptr(p_name);
  443. if (ptr) {
  444. return *ptr;
  445. }
  446. } else {
  447. if (const ClassMembers *_class = inner_classes.getptr(p_subclass)) {
  448. const lsp::DocumentSymbol *const *ptr = _class->getptr(p_name);
  449. if (ptr) {
  450. return *ptr;
  451. }
  452. }
  453. }
  454. return NULL;
  455. }
  456. const Array &ExtendGDScriptParser::get_member_completions() {
  457. if (member_completions.empty()) {
  458. const String *name = members.next(NULL);
  459. while (name) {
  460. const lsp::DocumentSymbol *symbol = members.get(*name);
  461. lsp::CompletionItem item = symbol->make_completion_item();
  462. item.data = JOIN_SYMBOLS(path, *name);
  463. member_completions.push_back(item.to_json());
  464. name = members.next(name);
  465. }
  466. const String *_class = inner_classes.next(NULL);
  467. while (_class) {
  468. const ClassMembers *inner_class = inner_classes.getptr(*_class);
  469. const String *member_name = inner_class->next(NULL);
  470. while (member_name) {
  471. const lsp::DocumentSymbol *symbol = inner_class->get(*member_name);
  472. lsp::CompletionItem item = symbol->make_completion_item();
  473. item.data = JOIN_SYMBOLS(path, JOIN_SYMBOLS(*_class, *member_name));
  474. member_completions.push_back(item.to_json());
  475. member_name = inner_class->next(member_name);
  476. }
  477. _class = inner_classes.next(_class);
  478. }
  479. }
  480. return member_completions;
  481. }
  482. Error ExtendGDScriptParser::parse(const String &p_code, const String &p_path) {
  483. path = p_path;
  484. lines = p_code.split("\n");
  485. Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, NULL, false);
  486. update_diagnostics();
  487. update_symbols();
  488. return err;
  489. }