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

Method parse_statement

modules/gdscript/gdscript_parser.cpp:1927–2145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1925}
1926
1927GDScriptParser::Node *GDScriptParser::parse_statement() {
1928 Node *result = nullptr;
1929#ifdef DEBUG_ENABLED
1930 bool unreachable = current_suite->has_return && !current_suite->has_unreachable_code;
1931#endif
1932
1933 List<AnnotationNode *> annotations;
1934 if (current.type != GDScriptTokenizer::Token::ANNOTATION) {
1935 while (!annotation_stack.is_empty()) {
1936 AnnotationNode *last_annotation = annotation_stack.back()->get();
1937 if (last_annotation->applies_to(AnnotationInfo::STATEMENT)) {
1938 annotations.push_front(last_annotation);
1939 annotation_stack.pop_back();
1940 } else {
1941 push_error(vformat(R"(Annotation "%s" cannot be applied to a statement.)", last_annotation->name));
1942 clear_unused_annotations();
1943 }
1944 }
1945 }
1946
1947 switch (current.type) {
1948 case GDScriptTokenizer::Token::PASS:
1949 advance();
1950 result = alloc_node<PassNode>();
1951 complete_extents(result);
1952 end_statement(R"("pass")");
1953 break;
1954 case GDScriptTokenizer::Token::VAR:
1955 advance();
1956 result = parse_variable(false, false);
1957 break;
1958 case GDScriptTokenizer::Token::TK_CONST:
1959 advance();
1960 result = parse_constant(false);
1961 break;
1962 case GDScriptTokenizer::Token::IF:
1963 advance();
1964 result = parse_if();
1965 break;
1966 case GDScriptTokenizer::Token::FOR:
1967 advance();
1968 result = parse_for();
1969 break;
1970 case GDScriptTokenizer::Token::WHILE:
1971 advance();
1972 result = parse_while();
1973 break;
1974 case GDScriptTokenizer::Token::MATCH:
1975 advance();
1976 result = parse_match();
1977 break;
1978 case GDScriptTokenizer::Token::BREAK:
1979 advance();
1980 result = parse_break();
1981 break;
1982 case GDScriptTokenizer::Token::CONTINUE:
1983 advance();
1984 result = parse_continue();

Callers

nothing calls this directly

Calls 11

vformatFunction · 0.85
applies_toMethod · 0.80
is_emptyMethod · 0.45
getMethod · 0.45
backMethod · 0.45
push_frontMethod · 0.45
pop_backMethod · 0.45
applyMethod · 0.45
push_backMethod · 0.45
get_nameMethod · 0.45
get_typeMethod · 0.45

Tested by

no test coverage detected