nom
nom copied to clipboard
permutation! doesn't recognize fn names in particular arrangements
I ran into this issue on 1.26 nightly(18 Mar version), but have reproduced on 1.24.1 as well. I am using nom 4.0.0-beta2, with no additional features activated.
When using permutation! with function names intermixed with macro invocations, it fails to compile with "unexpected end of macro invocation"
fn permutation()
{
let bytes1 = b"abcdefgh";
let bytes2 = b"defabcgh";
let bytes3 = b"ghiabcde";
let res1 = perm(bytes1);
let res2 = permutation!(bytes2,abc,tag!("def"),gh);
let res3 = perm(bytes3);
println!("Results! 1: {:?} 2: {:?} 3:{:?}",res1,res2,res3);
}
named!(perm<(&[u8],&[u8],&[u8])>, permutation!(abc,tag!("def"),gh));
named!(abc, tag!("abc"));
fn gh(input:&[u8]) -> IResult<&[u8],&[u8]>
{
tag!(input, "gh")
}
error: unexpected end of macro invocation
--> src\tests.rs:66:1
|
| named!(perm<(&[u8],&[u8],&[u8])>, permutation!(abc,tag!("def"),gh));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: unexpected end of macro invocation
--> src\tests.rs:60:16
|
| let res2 = permutation!(bytes2,abc,tag!("def"),gh);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
Hello, this should be fixed in 636b3de