fr.umlv.tatoo.runtime.parser
Interface SimpleParser<T>

Type Parameters:
T - type of terminal.
All Known Implementing Classes:
Parser

public interface SimpleParser<T>

Author:
Remi

Method Summary
 ActionReturn branchOnError(T terminal, String message)
          Signals to the parser an external error, (by example a lexer error) has occurred allowing the parser to try to branch (enter or exit from the current grammar).
 void close()
          Indicates to the parser that there is no more terminals.
 Set<? extends T> getLookahead()
          Returns the set of terminals which don't lead to an error for the current state.
 LookaheadMap<? extends T,?> getLookaheadMap()
          Returns the lookahead map.
 ReadOnlyIntStack getStateStack()
          Returns a view on the current parser state stack.
 ParserTable<T,?,?,?> getTable()
          Returns the table associated with the parser.
 boolean isBranchingParser()
          Returns true if the current parser is a branching parser
 void reset()
          Resets the parser and clears the state stack.
 SmartStepReturn smartStep(T next)
          Performs the actions induced by a particular terminal.
 void step(T next)
          Performs the actions induced by a particular terminal.
 

Method Detail

isBranchingParser

boolean isBranchingParser()
Returns true if the current parser is a branching parser

Returns:
true if the current parser is a branching parser

smartStep

SmartStepReturn smartStep(T next)
Performs the actions induced by a particular terminal. Return RELEX if the expected lookahead has changed during a reduce and that the lexer should reconsider its active rule set and NEXT otherwise. If this feature is used lexical semantic actions must not have already been performed. if NEXT token is required

Parameters:
next - the new terminal
Returns:
RELEX if the expected lookahead has changed during a reduce and that the lexer should reconsider its active rule set and NEXT if NEXT token is required

step

void step(T next)
Performs the actions induced by a particular terminal.

Parameters:
next - the terminal.

reset

void reset()
Resets the parser and clears the state stack.


close

void close()
Indicates to the parser that there is no more terminals.


getLookahead

Set<? extends T> getLookahead()
Returns the set of terminals which don't lead to an error for the current state. This is roughly equivalent to a call to getLookaheadMap().get(getStateStack().last()).

Returns:
a set of terminals or null if no lookahead states was provided at construction of the parser.

getLookaheadMap

LookaheadMap<? extends T,?> getLookaheadMap()
Returns the lookahead map.

Returns:
the lookahead map or null if no lookahead map was provided at construction of the parser.

getStateStack

ReadOnlyIntStack getStateStack()
Returns a view on the current parser state stack.

Returns:
an unmodifiable list of states.

getTable

ParserTable<T,?,?,?> getTable()
Returns the table associated with the parser.

Returns:
the parser table.

branchOnError

ActionReturn branchOnError(T terminal,
                           String message)
Signals to the parser an external error, (by example a lexer error) has occurred allowing the parser to try to branch (enter or exit from the current grammar).

See Also:
isBranchingParser(), ParserErrorRecoveryPolicy.recoverOnError(Parser, IntArrayList, Object, String)