Use push parser for selection parsing.
The push parser is new in Bison 2.4 (current parser.cpp files generated
with 2.5), and has two benefits in our case:
- Clearer control flow, since the interactive prompt loop is now outside
the parser, so it doesn't need to behave like a state machine.
- Allows better exception handling: since it is possible to directly
return from Flex actions, we should also be able to throw exceptions.
But without this change, they would go through the generated part of
the Bison parser, causing memory leaks since the code is generated for
C. With this change, the Flex scanner is called directly from C++
code, eliminating this problem.
Since the Bison and Flex parsers are now decoupled, it should also be
possible to clarify the code further, by having a separate data
structure for parser-specific data instead of using yyscan_t. For now,
kept the changes to a minimum.
Related to #880.
Change-Id: I43ea11561d3dd0577dd95eae3794ca621953d038
13 files changed: