You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think you're right. Your second example creates a parser that cannot parse a newline (but does not parse anything else), and then that parser succeeds at failing to parse the newline. However, there is still text to parse, so parjs throws an error (you must handle all input by default).
You have two options:
it("can parse with anyChar()",()=>{constp=newline().pipe(not(),qthen(anyChar()));expect(p.parse("a")).toBeSuccessful("a");expect(p.parse("\n")).toBeFailure(ResultKind.SoftFail);});it("can parse with must",()=>{constp=anyChar().pipe(must(c=>c!=="\n"||{kind: "Soft"}));expect(p.parse("a")).toBeSuccessful("a");expect(p.parse("\n")).toBeFailure(ResultKind.SoftFail);});
I'd like match any char that isn't a newline.
This works as expected:
In the following example, no input is consumed:
Is the intended way to write something like this using then?
The text was updated successfully, but these errors were encountered: