diff --git a/mist-test/src/app.mist b/mist-test/src/app.mist index 25f64b3..5c09745 100644 --- a/mist-test/src/app.mist +++ b/mist-test/src/app.mist @@ -14,8 +14,7 @@ pub class Application { i32 ticks; pub constructor(str* name) { - self.name; - + self.name = name.to_string(); self.tasks = new Vec(); self.plugins = new Vec(); diff --git a/parser/src/grammar.pest b/parser/src/grammar.pest index 9dbe487..3b08ce8 100644 --- a/parser/src/grammar.pest +++ b/parser/src/grammar.pest @@ -76,14 +76,6 @@ visibility = { "pub" ~ ("(" ~ static_path ~ ")")? } mutable = { "mut" } var = { "var" } -// ====================================================== -// ERROR RECOVERY -// ====================================================== - -unexpected_statement = { - (!(semicolon | "}" | statement) ~ ANY)+ -} - // ====================================================== // GENERICS // ====================================================== diff --git a/parser/src/parser/common/expr.rs b/parser/src/parser/common/expr.rs index 86dd684..de33878 100644 --- a/parser/src/parser/common/expr.rs +++ b/parser/src/parser/common/expr.rs @@ -78,7 +78,7 @@ impl<'a> TryFrom> for Expression { Rule::static_path => ast_expr!(Expression::Path(pair.try_into())), Rule::literal => ast_expr!(Expression::Literal(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)) ), diff --git a/parser/src/parser/common/statement.rs b/parser/src/parser/common/statement.rs index 8e4f4a4..516d32d 100644 --- a/parser/src/parser/common/statement.rs +++ b/parser/src/parser/common/statement.rs @@ -2,7 +2,7 @@ use crate::{ Rule, ast::*, ast_ensure, ast_expr, - error::{AstError, AstResult, ErrorCode, IntoErr, collect_recovered}, + error::{AstError, AstResult, IntoErr, collect_recovered}, parser::listen_rule, }; @@ -101,15 +101,6 @@ impl<'a> TryFrom> for Statement { .collect::>>(), )), - 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), } }