parser
parser copied to clipboard
Update parser as per latest changes in nom
Thanks for the PR!
Do you have an idea why tests are failing?
I will take a look. I did cargo build, and I came to know to know that InputTake and InputTakeAtPosition are not implemented. I will look into the tests.
I looked into the remaining failing tests. One of them is case_exclude_empty_set(). I found that it is failing because it uses the InputTakeAtPosition and FindToken implementations of &[u8] which is provided by the nom framework.
The test output:
Diff < left / right > :
<Err(
< Incomplete(
< Size(
< 1
< )
>Ok(
> (
> [],
> [
> 102,
> 101,
> 100,
> 97,
> 98,
> 99
> ]
)
)
Do you think that they need to be implemented differently inside the parser library? @Hywan
fn case_exclude_empty_set() {
named!(
test,
exclude!(
is_a!("abcdef"),
alt!(
tag!("abc")
| tag!("ace")
)
)
);
assert_eq!(test(&b"fedabc"[..]), Ok((&b""[..], &b"fedabc"[..])));
}
is_a!("abcdef") uses find_token() which returns bool. But split_at_position1() does Some() pattern match-ing. This is weird. I think I am missing something here. Any idea?
Please, give me some days to look at this. I don't time right now, hope to get free time in few days :-). Thanks for your patience!
Meanwhile I can do more investigation.
https://github.com/tagua-vm/parser/pull/132#issuecomment-428047935 - I am wrong in this comment. It is alright there. The find() inside split_at_position1() expects the Fn to return a bool
But I am confused here because in every iteration it is true, still it is executing the None arm.
Working on this right now.
@Hywan Did you check this?
Yes, and I have similar issue. I've paused my patch for some weeks because of other projects. I'm planning to switch back to Tagua VM very soon.