com.singularsys.jep.configurableparser
Class ShuntingYard

java.lang.Object
  extended by com.singularsys.jep.configurableparser.ShuntingYard
All Implemented Interfaces:
GrammarParser

public class ShuntingYard
extends java.lang.Object
implements GrammarParser

An operator precedence parser based on the shunting yard algorithm.


Field Summary
protected static boolean DUMP
           
protected  Lookahead2Iterator<Token> it
           
protected  Jep jep
           
protected  java.util.List<GrammarMatcher> matchers
           
protected  java.util.Stack<Node> nodes
           
protected  java.util.Stack<Operator> ops
           
protected static Operator sentinel
           
 
Constructor Summary
ShuntingYard(Jep jep, java.util.List<GrammarMatcher> gm)
           
 
Method Summary
protected  void dumpState(java.lang.String msg)
           
 Lookahead2Iterator<Token> getIterator()
           
 Node parse(java.util.Iterator<Token> input)
           
 Node parseSubExpression()
          Callback function used by GrammerMatchers
 void setIterator(Lookahead2Iterator<Token> it)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUMP

protected static final boolean DUMP
See Also:
Constant Field Values

ops

protected java.util.Stack<Operator> ops

nodes

protected java.util.Stack<Node> nodes

it

protected Lookahead2Iterator<Token> it

matchers

protected java.util.List<GrammarMatcher> matchers

jep

protected Jep jep

sentinel

protected static Operator sentinel
Constructor Detail

ShuntingYard

public ShuntingYard(Jep jep,
                    java.util.List<GrammarMatcher> gm)
Method Detail

parse

public Node parse(java.util.Iterator<Token> input)
           throws ParseException
Throws:
ParseException

parseSubExpression

public Node parseSubExpression()
                        throws ParseException
Callback function used by GrammerMatchers

Specified by:
parseSubExpression in interface GrammarParser
Returns:
the root node of the matched sub expression.
Throws:
ParseException

dumpState

protected void dumpState(java.lang.String msg)

getIterator

public Lookahead2Iterator<Token> getIterator()

setIterator

public void setIterator(Lookahead2Iterator<Token> it)


Copyright © 2008 Singular Systems http://www.singularsys.com/jep