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 am struggling to find a way to get the range of my parsed input and I am not sure whether this is something which would be useful to this library.
For example consider the following use case:
I am writing an ingredient parser and I want to make sense of a string by parsing the ingredient amount and unit. But I also want to highlight the parse amount and unit when displaying the ingredient string in a NSAttributedString. From my understand I would need to know which range the parser combinator parsed.
Activity
stephencelis commentedon Nov 29, 2021
Hi @dehlen,
One way to capture the range of a parsed result is by introducing a new operator that captures it. Here's something @mbrandonw and I sketched out:
With that defined, you can get the range from
Int.parser()by tacking onwithRange():Hope this helps!
I'm going to convert this to a discussion, since it's not a bug with the library.