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

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.