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 4e7806d053
commit 8d79074ea9
1 changed files with 22 additions and 1 deletions

View File

@ -305,7 +305,8 @@ macro_rules! delimited {
acc.push($self.$parse_fn()?);
match $self.peek() {
$( $delim )|* => { $self.next(); continue },
_ => break
_ if $strictness => break,
_ => continue,
};
}
expect!($self, $end, $end_str);
@ -986,6 +987,26 @@ mod parse_tests {
parse_test!("fn a(x) {\n x() }", 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 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]