Building Parsers with Java

sjm.examples.query
Class VariableAssembler

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

public class VariableAssembler
extends Assembler

This assembler pops a token from the stack, extracts its string, and pushes a Variable of that name. This assembler also looks up the name in a ChipSpeller, and throws a runtime exception if this variable name is unknown.


Constructor Summary
VariableAssembler(Speller speller)
          Construct a VariableAssembler that will consult the given speller for the proper spelling of variable names.
 
Method Summary
 void workOn(Assembly a)
          Pop a token from the stack, extract its string, and push a Variable of that name.
 
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(Speller speller)
Construct a VariableAssembler that will consult the given speller for the proper spelling of variable names.
Method Detail

workOn

public void workOn(Assembly a)
Pop a token from the stack, extract its string, and push a Variable of that name. Check the spelling of the name with the speller provided in the constructor.
Overrides:
workOn in class Assembler
Tags copied from class: Assembler
Parameters:
Assembly - the assembly to work on

by Steve Metsker