Fix bug in delimited macro

Had to do with bad strictness testing.
This commit is contained in:
greg 2018-03-02 22:40:12 -08:00
parent 9ab1ca28f8
commit 9747374e8a

View File

@ -305,7 +305,8 @@ macro_rules! delimited {
acc.push($self.$parse_fn()?); acc.push($self.$parse_fn()?);
match $self.peek() { match $self.peek() {
$( $delim )|* => { $self.next(); continue }, $( $delim )|* => { $self.next(); continue },
_ => break _ if $strictness => break,
_ => continue,
}; };
} }
expect!($self, $end, $end_str); expect!($self, $end, $end_str);
@ -986,6 +987,26 @@ mod parse_tests {
parse_test!("fn a(x) {\n x() }", AST(vec![Declaration( parse_test!("fn a(x) {\n x() }", AST(vec![Declaration(
FuncDecl(Signature { name: rc!(a), params: vec![(rc!(x),None)], type_anno: None }, FuncDecl(Signature { name: rc!(a), params: vec![(rc!(x),None)], type_anno: None },
vec![exprstatement!(Call { f: bx!(ex!(val!("x"))), arguments: vec![] })]))])); vec![exprstatement!(Call { f: bx!(ex!(val!("x"))), arguments: vec![] })]))]));
let multiline = r#"
fn a(x) {
x()
}
"#;
parse_test!(multiline, AST(vec![Declaration(
FuncDecl(Signature { name: rc!(a), params: vec![(rc!(x),None)], type_anno: None },
vec![exprstatement!(Call { f: bx!(ex!(val!("x"))), arguments: vec![] })]))]));
let multiline2 = r#"
fn a(x) {
x()
}
"#;
parse_test!(multiline2, AST(vec![Declaration(
FuncDecl(Signature { name: rc!(a), params: vec![(rc!(x),None)], type_anno: None },
vec![exprstatement!(Call { f: bx!(ex!(val!("x"))), arguments: vec![] })]))]));
} }
#[test] #[test]