Removed invalid statement
This commit is contained in:
@@ -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();
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
// ======================================================
|
// ======================================================
|
||||||
|
|||||||
@@ -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))
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user