Flow control
This commit is contained in:
parent
92c6d7f311
commit
5af42d0828
@ -35,8 +35,14 @@ peg::parser! {
|
||||
rule statement_kind() -> StatementKind =
|
||||
__ import:import() { StatementKind::Import(import) } /
|
||||
__ decl:declaration() { StatementKind::Declaration(decl) } /
|
||||
__ flow:flow() { StatementKind::Flow(flow) } /
|
||||
__ expr:expression() { StatementKind::Expression(expr) }
|
||||
|
||||
rule flow() -> FlowControl =
|
||||
"continue" { FlowControl::Continue } /
|
||||
"break" { FlowControl::Break } /
|
||||
"return" _ expr:expression()? { FlowControl::Return(expr) }
|
||||
|
||||
rule import() -> ImportSpecifier =
|
||||
"import" _ path_components:path_components() suffix:import_suffix()? {
|
||||
ImportSpecifier {
|
||||
|
@ -1292,7 +1292,7 @@ fn flow_control() {
|
||||
return 10;
|
||||
}"#;
|
||||
|
||||
assert_ast!(
|
||||
assert_ast2!(
|
||||
source,
|
||||
vec![fn_decl(
|
||||
Signature { name: rc("test"), operator: false, type_anno: None, params: vec![] },
|
||||
|
Loading…
Reference in New Issue
Block a user