O'Reilly logo

Building Parsers with Java™ by Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required