I'm migrating a dynamic parser (the rule is generated dynamically) from pb1 to pb2.
It could be great to have a mutable ParserInput.
So, parser looks like:
class MyParser(format: Format) {
def MainRule = ??? // genarating a rule based on the format
def parse(input: String): ParsedDataStructure = {
setInput(input) // mutation
//parsing
....
}
}
So it's created once, and pares multiple times.
As far as I understand, in pb2 each parsing procedure requires parser creation.
It's costly for my case. Is there any kind of work around for this problem?
Because (even when I'm trying to mutate the input) parser stops working since the 2nd line.
Thanks, Paul.