fr.umlv.tatoo.runtime.parser
Class ReduceAction<T,P,V>

java.lang.Object
  extended by fr.umlv.tatoo.runtime.parser.Action<T,P,V>
      extended by fr.umlv.tatoo.runtime.parser.ReduceAction<T,P,V>
Type Parameters:
T - type of terminals.
P - type of productions.
V - type of versions.

public class ReduceAction<T,P,V>
extends Action<T,P,V>

Reduce action class.

Author:
Julien Cervelle

Constructor Summary
ReduceAction(P production, int rightSize, int[] gotos)
          Constructs a reduce action.
 
Method Summary
<N> ActionReturn
doPerform(Parser<T,N,P,V> parser, T terminal)
          Performs necessary computations required by the action.
 P getProduction()
          Returns the production on which the reduce is performed.
 int getRightSize()
          Returns the size of the right hand size of the production associated with this reduce action.
 String toString()
           
 
Methods inherited from class fr.umlv.tatoo.runtime.parser.Action
isError, isShift
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReduceAction

public ReduceAction(P production,
                    int rightSize,
                    int[] gotos)
Constructs a reduce action.

Parameters:
production - production associated with this reduce action.
rightSize - size of the production right hand side.
gotos - goto array used for goto actions after reduction.
Method Detail

getProduction

public P getProduction()
Returns the production on which the reduce is performed.

Returns:
the production.

getRightSize

public int getRightSize()
Returns the size of the right hand size of the production associated with this reduce action.

Returns:
the right hand side size.

doPerform

public <N> ActionReturn doPerform(Parser<T,N,P,V> parser,
                                  T terminal)
Description copied from class: Action
Performs necessary computations required by the action.

Specified by:
doPerform in class Action<T,P,V>
Type Parameters:
N - type of non-terminals.
Parameters:
parser - the parser object.
terminal - terminal on which the shift is performed.
Returns:
NEXT if action consumed terminal, and KEEP else.

toString

public String toString()
Overrides:
toString in class Object