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

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

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

Action that behaves differently depending of the version of the grammar. This class acts as a composite of versioned actions.

Author:
Remi Forax

Constructor Summary
VersionedAction(Map<V,? extends Action<T,P,V>> actionMap)
          Initializes the action with a map of versioned actions.
 
Method Summary
<N> ActionReturn
doPerform(Parser<T,N,P,V> parser, T terminal)
          Performs necessary computations required by the action.
 boolean isError(V version)
          Indicates if the action is an error.
 
Methods inherited from class fr.umlv.tatoo.runtime.parser.Action
isShift
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionedAction

public VersionedAction(Map<V,? extends Action<T,P,V>> actionMap)
Initializes the action with a map of versioned actions.

Parameters:
actionMap - the map of versioned actions.
Method Detail

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.

isError

public boolean isError(V version)
Description copied from class: Action
Indicates if the action is an error.

Overrides:
isError in class Action<T,P,V>
Parameters:
version - version of the action to consider, see VersionedAction.
Returns:
true if the action is an errror.