Building Parsers with Java

sjm.examples.sling
Class VariableAssembler

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

public class VariableAssembler
extends Assembler

This class looks up a variable by name, using the word on an assembly's stack, and pushes a Variable of that name.

This class expects an assembly's target to be a SlingPlot object. The target has a "scope", which is a collection of variables organized by name. When this assembler works on an assembly, it pops a name from the stack, looks up a variable in the scope using the name, and pushes the variable onto the stack. This lookup creates the variable in the scope if the scope does not already contain a variable of that name.


Constructor Summary
VariableAssembler()
           
 
Method Summary
 void workOn(Assembly a)
          Pop the name of a variable, lookup the variable in the target's scope, and push the variable.
 
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

VariableAssembler

public VariableAssembler()
Method Detail

workOn

public void workOn(Assembly a)
Pop the name of a variable, lookup the variable in the target's scope, and push the variable.
Overrides:
workOn in class Assembler
Tags copied from class: Assembler
Parameters:
Assembly - the assembly to work on

by Steve Metsker