Using sequence() with more than 7 parsers

46 Views Asked by At

I am trying to build a parser combinator that uses Parsers.sequence() but with more than 7 parsers, 26 to be exact. Unfortunately the Parsers.sequence() method only takes up to 7 parsers. I read on another stack overflow question that using Parsers.List() would be necessary. However, that seems to be an issue. That method returns a List<Object>. I use this parser to parse through 26 parsers where only 10 of them return a valuable token that I will use in a constructor to initialise an object from a custom class. Having a list of object isn't very good because I would have to downcast all the items in the list in the correct type for my constructor.

What is the better way of doing this?

0

There are 0 best solutions below