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

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.