10.4. Collection Parsers

The Sequence and Alternation classes are subclasses of CollectionParser, as Figure 10.3 shows. These classes have a common way of adding and storing their subparsers. They differ primarily in how they match a set of assemblies.

Figure 10.3. The CollectionParser class. CollectionParser is the abstract superclass of the two fundamental types of collection parsers: Alternation and Sequence.

The main behavior that CollectionParser provides to its subclasses is the ability to add a parser to a collection.

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.