Building Parsers with Java

sjm.examples.sling
Class ForAssembler

java.lang.Object
  |
  +--sjm.parse.Assembler
        |
        +--sjm.examples.sling.ForAssembler

public class ForAssembler
extends Assembler

Builds a "for" command from elements on the stack, which should be: a variable, a "from" function, a "to" function, a '{' token, and a series of commands.

This class uses the curly brace as a fence, popping commands above it and creating a composite command from these commands. This composite command is the body of the "for" loop. This assembler pops the "from" and "to" functions and the variable, constructs a ForCommand object, and pushes it.


Constructor Summary
ForAssembler()
           
 
Method Summary
protected static CommandSequence popCommandSequence(Assembly a)
           
 void workOn(Assembly a)
          Pop the elements of a "for" loop, construct a ForCommand, and push it.
 
Methods inherited from class sjm.parse.Assembler
elementsAbove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForAssembler

public ForAssembler()
Method Detail

popCommandSequence

protected static CommandSequence popCommandSequence(Assembly a)

workOn

public void workOn(Assembly a)
Pop the elements of a "for" loop, construct a ForCommand, and push it.
Overrides:
workOn in class Assembler
Parameters:
Assembly - the assembly to work on

by Steve Metsker