question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Odd behavioral intersection of combinators (alt/or and times).

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

2reactions
theqabalistcommented, Oct 2, 2018

oh wait, if I make the EOF explicit, then it would actually fail. So something like seq(digits, EOF) would fail in the alt.

0reactions
wavebeemcommented, Oct 2, 2018

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found