Odd behavioral intersection of combinators (alt/or and times).
See original GitHub issueI am experiencing behavior which I both don’t expect, and do not immediately understand. It seems like however times is implemented breaks the usage of the fallback combinators. Both alt and .or
seem to break when used with times. Example:
const P = require('parsimmon');
P.digit.times(2).or(P.any.atLeast(1).tie()).tryParse('56a') // throws exception because the first parser fails.
P.alt(
P.digit.times(2),
P.any.atLeast(1).tie()
).tryParse('56a') // also fails
This would seem to be incorrect behavior. I can work on a fix if anyone can corroborate that this is not supposed to behave this way.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Oppositional defiant disorder (ODD) - Symptoms and causes
ODD is a childhood mental health disorder that includes frequent and persistent anger, irritability, arguing, defiance or vindictiveness ...
Read more >Oppositional Defiant Disorder (ODD): Symptoms & Treatment
Oppositional defiant disorder (ODD) is a condition in which your child displays a pattern of uncooperative, defiant and angry behavior ...
Read more >Oppositional Defiant Disorder (ODD) in Children
Oppositional defiant disorder (ODD) is a type of behavior disorder. It is mostly diagnosed in childhood. Children with ODD are uncooperative, defiant, ...
Read more >Oppositional Defiant Disorder (ODD): A Quick Guide
Oppositional defiant disorder (ODD) is a children's mental health disorder that involves defying parents, breaking rules, and other serious ...
Read more >Oppositional Defiant Disorder - StatPearls - NCBI Bookshelf
Oppositional defiant disorder (ODD) is a type of childhood disruptive behavior disorder that primarily involves problems with the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
oh wait, if I make the EOF explicit, then it would actually fail. So something like
seq(digits, EOF)
would fail in the alt.Based on https://github.com/jneen/parsimmon/issues/143 I’m likely to go ahead and implement https://github.com/jneen/parsimmon/issues/193 (which you could monkey patch locally and play with)