Fork me on GitHub

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.


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.


Sounds good. Thank you!


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