Removed invalid statement

This commit is contained in:
2026-05-21 11:07:49 +02:00
parent 2fcb8c3831
commit 9da4a50ef5
4 changed files with 3 additions and 21 deletions
+1 -2
View File
@@ -14,8 +14,7 @@ pub class Application {
i32 ticks; i32 ticks;
pub constructor(str* name) { pub constructor(str* name) {
self.name; self.name = name.to_string();
self.tasks = new Vec(); self.tasks = new Vec();
self.plugins = new Vec(); self.plugins = new Vec();
-8
View File
@@ -76,14 +76,6 @@ visibility = { "pub" ~ ("(" ~ static_path ~ ")")? }
mutable = { "mut" } mutable = { "mut" }
var = { "var" } var = { "var" }
// ======================================================
// ERROR RECOVERY
// ======================================================
unexpected_statement = {
(!(semicolon | "}" | statement) ~ ANY)+
}
// ====================================================== // ======================================================
// GENERICS // GENERICS
// ====================================================== // ======================================================
+1 -1
View File
@@ -78,7 +78,7 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Expression {
Rule::static_path => ast_expr!(Expression::Path(pair.try_into())), Rule::static_path => ast_expr!(Expression::Path(pair.try_into())),
Rule::literal => ast_expr!(Expression::Literal(pair.try_into())), Rule::literal => ast_expr!(Expression::Literal(pair.try_into())),
Rule::expr_path => ast_expr!(Expression::Path(pair.try_into())), Rule::expr_path => ast_expr!(Expression::Path(pair.try_into())),
Rule::statement | Rule::basic_stmt | Rule::control_flow | Rule::unexpected_statement => ast_expr!( Rule::statement | Rule::basic_stmt | Rule::control_flow => ast_expr!(
Expression::Statement(pair.try_into().get_map(Box::new).map(Box::new)) Expression::Statement(pair.try_into().get_map(Box::new).map(Box::new))
), ),
+1 -10
View File
@@ -2,7 +2,7 @@ use crate::{
Rule, Rule,
ast::*, ast::*,
ast_ensure, ast_expr, ast_ensure, ast_expr,
error::{AstError, AstResult, ErrorCode, IntoErr, collect_recovered}, error::{AstError, AstResult, IntoErr, collect_recovered},
parser::listen_rule, parser::listen_rule,
}; };
@@ -101,15 +101,6 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Statement {
.collect::<AstResult<'a, Vec<_>>>(), .collect::<AstResult<'a, Vec<_>>>(),
)), )),
Rule::unexpected_statement => {
return Err(AstError {
span: pair.as_span(),
error_code: ErrorCode::InvalidStatement,
error_message: "Invalid Statement".to_string(),
recovered: None,
});
}
_ => AstError::bug_unimplemented(pair), _ => AstError::bug_unimplemented(pair),
} }
} }