Class Shift

java.lang.Object
  |
  +--Action
        |
        +--Shift

public class Shift
extends Action

This class implements the shift action specified in the LR parsing program from Figure 4.30 of the Dragon book.


Constructor Summary
Shift(int state)
          Constructs a shift action into specified new state.
 
Method Summary
 int process(LRTable T, LRStack stack, java.lang.String a, int ip)
          Performs the shift actions specified in the LR parsing program from Figure 4.30 of the Dragon book:

push a then s' on top of the stack
advance ip to the next input symbol
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Shift

public Shift(int state)
Constructs a shift action into specified new state.

Method Detail

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object

process

public int process(LRTable T,
                   LRStack stack,
                   java.lang.String a,
                   int ip)
Performs the shift actions specified in the LR parsing program from Figure 4.30 of the Dragon book:

push a then s' on top of the stack
advance ip to the next input symbol

Specified by:
process in class Action
Parameters:
T - LR parsing table (ignored)
stack - the stack
a - the current input symbol
ip - the current input-symbol pointer
Returns:
incremented value of ip