Open cAttte opened 4 weeks ago
Is this using the latest main
? If so, I have an inkling...
hey, nope this is on alpha.7. i've tried main
but i get a weird error, i can keep trying if you think it'd help!
What's the error, out of interest?
I think I know what's causing this, but resolving it in the general case is... a little finickey, I think.
ha, i was trying to build with the nightly
feature on stable, so that's what the error was.
sounds interesting, if you could explain it a little bit that would be cool, maybe someone can help
So when a parser succeeds, it leaves the input pointing at the next token after whatever it parsed. But when a parser fails, the state it leaves the parser in is unspecified (as in: that's how chumsky behaves right now).
The problem is that labelled
depends on the input being left in a specific place, since it determines whether to treat the label as a pattern (i.e: expected foo
) or context (i.e: error occurred while parsing foo
).
The reason this works with just
and not one_of
is because the former rewinds the input on failure, while the latter does not. Fixing this is as simple as making the two consistent, but to really fix it chumsky probably needs to take a clearer stance on what state the input should be left in on failure - which also means building that stance into the extension API and so on.
I can give more information tomorrow.
hey! i was trying to apply some labels on a
.one_of(Range)
parser but it didn't work, so i decided to try a few other cases:as you can see the label does not show up in cases where
one_of()
is used. let me know if i'm doing something wrong!