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

16.6. Sling Commands

There are three commands in the Sling language: plot, assignment, and for. The for command is syntactically different from a Java for command, but its function is similar. The plot command and the assignment command need application-specific implementations in sjm.examples.sling.

16.6.1. AddFunctionCommand

This command encapsulates a user's plot command. Internally, the Sling parser does not actually start drawing when it parses a plot command. Rather, the parser uses an assembler to place an AddFunctionCommand object on an assembly's stack. Figure 16.22 shows AddFunctionCommand.

Figure 16.22. The AddFunctionCommand class. An AddFunctionCommand object holds a SlingFunction object that it evaluates and adds to a collection ...

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