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

11.5. Summary

The most common motivation for extending the parser toolkit in sjm.parse is to provide a new Terminal subclass that recognizes a subset of tokens of an existing type, or that recognizes a new token type that you create. In addition, you may want to add behavior to the Parser hierarchy that provides a feature other than matching. The Track class is an example of an extension to the parsers in sjm.parse that does not increase the ability to match but adds value when the match fails.

In your own projects, you should feel free to extend, override, and replace the classes in any of the sjm packages. The same is true of the java packages and object-oriented programming in general. In the object-oriented era, the practice of programming ...

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