I'm trying to write a thrift parser with pyparsing.
The parse result I want to see is a dict that maps element names to parsed tokens.
After defining the elements, I call scanString on each of them to parse for the corresponding tokens, and then make a dict from the results.
But this requires multiple pass through the source, one for each of the elements, eg. one for parsing constants, one for exceptions, one for structs ...
Is it possible to parse multiple elements in one go and still be able to separate the tokens according to their types?