10.8. Terminal Matching
The parsers discussed to this point have been compositions of other parsers. Each of them matches a collection of assemblies by delegating the matching job to its subparsers. This structural composition and runtime delegation ends with Terminal and its subclasses. Terminal objects are the leaves of a parser composition and thus “terminate” the composition. They also terminate the matching process by deciding themselves whether or not they match a given assembly. Figure 10.6 shows the Terminal class.
Figure 10.6. The Terminal class. A Terminal object is a parser that is not a composition of other parsers.
Any Terminal object ...
Get Building Parsers with Java™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.