java_cup.runtime
Class virtual_parse_stack

java.lang.Object
  extended by java_cup.runtime.virtual_parse_stack

public class virtual_parse_stack
extends java.lang.Object

This class implements a temporary or "virtual" parse stack that replaces the top portion of the actual parse stack (the part that has been changed by some set of operations) while maintaining its original contents. This data structure is used when the parse needs to "parse ahead" to determine if a given error recovery attempt will allow the parse to continue far enough to consider it successful. Once success or failure of parse ahead is determined the system then reverts to the original parse stack (which has not actually been modified). Since parse ahead does not execute actions, only parse state is maintained on the virtual stack, not full Symbol objects.

Version:
last updated: 7/3/96
Author:
Frank Flannery
See Also:
lr_parser

Constructor Summary
virtual_parse_stack(java.util.Stack shadowing_stack)
          Constructor to build a virtual stack out of a real stack.
 
Method Summary
 boolean empty()
          Indicate whether the stack is empty.
 void pop()
          Pop the stack.
 void push(int state_num)
          Push a state number onto the stack.
 int top()
          Return value on the top of the stack (without popping it).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

virtual_parse_stack

public virtual_parse_stack(java.util.Stack shadowing_stack)
                    throws java.lang.Exception
Constructor to build a virtual stack out of a real stack.

Throws:
java.lang.Exception
Method Detail

empty

public boolean empty()
Indicate whether the stack is empty.


top

public int top()
        throws java.lang.Exception
Return value on the top of the stack (without popping it).

Throws:
java.lang.Exception

pop

public void pop()
         throws java.lang.Exception
Pop the stack.

Throws:
java.lang.Exception

push

public void push(int state_num)
Push a state number onto the stack.