Fork me on GitHub
#instaparse
<
2020-03-05
>
bmaddy03:03:01

I have a question about how to do something in Instaparse. Imagine a string like this:

3 1 John 0 2 Jane 2 1 3 3 Bob 0
The first number is the number of people. Then, for each person, an id, name, number of people they supervise, and list of ids for the people they supervise. So in that example string there are 3 people. Jane (id = 2) supervises John (id = 1) and Bob (id = 3). Can I use Instaparse to parse stuff like that? Specifically, I'm wondering how to read a number n and parse exactly n items after that.

aengelberg04:03:47

sadly Instaparse isn't well suited for situations where you parse a thing and then use that as an input to some later part of the same parser.

bmaddy04:03:42

Sounds good. Thank you!

zane17:03:53

Out of curiosity, what would be better suited for situations like that?