Skip to content

.or() taking wrong parser #684

Answered by uyuF
uyuF asked this question in Q&A
Oct 21, 2024 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

After a bit of bug testing I think the issue lays with my string parser which the call parser uses

fn string_parser() -> impl Parser<char, String, Error = Simple<char>> {
    filter(|c: &char| !c.is_whitespace())
    .repeated()
    .collect::<String>()
}

No matter what code I use as input, i.e.

PENDOWN

It would always go to the call parser, which prints the result "Parsing: " over and over until the program crashes, I'm not too sure but I think it's trying to parse an empty character or maybe the end of file character

I fixed this by changing my string parser to be similar to text::ident()

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@zesterer
Comment options

@uyuF
Comment options

@zesterer
Comment options

@uyuF
Comment options

Answer selected by uyuF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants