fr.umlv.tatoo.runtime.lexer.rules
Class Action<R>

java.lang.Object
  extended by fr.umlv.tatoo.runtime.lexer.rules.Action<R>
Type Parameters:
R - type of rules.

public class Action<R>
extends Object

This class contains the live data used to process one rule of the lexer. A rule data is break down in one regular expression and one optional regular expresison represented by the class RuleData. The state of the automaton of a regular expression is represented by the class DFA.

Author:
Julien Cervelle
See Also:
RuleData, DFA

Constructor Summary
Action()
          Creates an action.
 
Method Summary
 R getRule()
          Returns the rule of the current action.
 int lastMatch()
          Returns the last buffer position that has matched the rule.
 void reset(R rule, RuleData ruleData)
          Reuse the action with a new rule and its data.
 boolean step(int a)
          Steps by one letter on the internal automaton and returns false if the letter is rejected or accepted by the automaton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Action

public Action()
Creates an action.

Method Detail

reset

public void reset(R rule,
                  RuleData ruleData)
Reuse the action with a new rule and its data.

Parameters:
rule - the lexer rule
ruleData - the data generated by Tatoo lexer containing the two regular expressions associated with the rule

step

public boolean step(int a)
Steps by one letter on the internal automaton and returns false if the letter is rejected or accepted by the automaton.

Parameters:
a - the letter
Returns:
true is a futher step is needed in order to parse a token.

lastMatch

public int lastMatch()
Returns the last buffer position that has matched the rule.

Returns:
the last buffer position that has matched the rule.

getRule

public R getRule()
Returns the rule of the current action.

Returns:
the rule of the current action.