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.5. Sequence Matching

A Sequence parser holds a collection of parsers that must each, in turn, match against an assembly. Matching is the main service that the Sequence class provides, as Figure 10.4 shows.

Figure 10.4. The Sequence class. Sequence implements match() so that matching succeeds only if all the parsers in its collection match in succession.

When a sequence matches, it matches against an input collection of assemblies. To perform the match, the sequence matches its first subparser against each assembly in the collection. The result is a new collection of assemblies, all having one property in common: They all are assemblies that ...

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