fr.umlv.tatoo.runtime.tools.builder
Class ParserBuilder<T,N,P,V>

java.lang.Object
  extended by fr.umlv.tatoo.runtime.tools.builder.ParserBuilder<T,N,P,V>

public class ParserBuilder<T,N,P,V>
extends Object


Constructor Summary
protected ParserBuilder(ParserTable<T,N,P,V> table)
           
 
Method Summary
protected  ParserErrorRecoveryPolicy<T,N,P,V> createNoErrorRecoveryPolicy()
          Overrides this method if you want to change the warning reporter used by the no error recovery policy.
 Parser<T,N,P,V> createParser()
           
static
<T,N,P,V> ParserBuilder<T,N,P,V>
createParserBuilder(ParserTable<T,N,P,V> table)
           
 SimpleParser<T> createSimpleParser()
           
 BranchingParserListener<? super T> getBranchingParserListener()
           
 ErrorRecoveryListener<? super T,? super N> getErrorRecoveryListener()
           
 LookaheadMap<? extends T,? super V> getLookaheadMap()
           
 ParserErrorRecoveryPolicy<T,N,P,V> getParserErrorRecoveryPolicy()
           
 ParserListener<? super T,? super N,? super P> getParserListener()
           
 ParserTable<T,N,P,V> getParserTable()
          Returns the parser table.
 N getStart()
          Returns the starting non termianl of the grammar that will be used to start the parsing.
 V getVersion()
          Returns the version of the grammar that will be used during parsing.
 ParserBuilder<T,N,P,V> setBranchingParserListener(BranchingParserListener<? super T> branchingListener)
          optional (default null)
static
<T extends Enum<T>,N,P,V extends Enum<V>>
ParserBuilder<T,N,P,V>
setEnumLookaheadMap(ParserBuilder<T,N,P,V> builder)
          parser table must be set before calling this method.
 ParserBuilder<T,N,P,V> setHashLookaheadMap()
          parser table and version (or default) must be set before calling this method.
 ParserBuilder<T,N,P,V> setLookaheadMap(LookaheadMap<? extends T,? super V> lookaheadMap)
          optional (default is no lookahead map)
 ParserBuilder<T,N,P,V> setParserErrorRecoveryListener(ErrorRecoveryListener<? super T,? super N> errorRecoveryListener)
          optional (default is no error recovery)
 ParserBuilder<T,N,P,V> setParserErrorRecoveryPolicy(ParserErrorRecoveryPolicy<T,N,P,V> policy)
          Set the paraesr error recovery policy.
 ParserBuilder<T,N,P,V> setParserListener(ParserListener<? super T,? super N,? super P> listener)
          optional (default prints actions on standard error)
 ParserBuilder<T,N,P,V> setStart(N start)
          Set the non terminal that will be used to start the parsing.
 ParserBuilder<T,N,P,V> setVersion(V version)
          Set the version of the grammar that will be use to start the parsing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserBuilder

protected ParserBuilder(ParserTable<T,N,P,V> table)
Method Detail

createParserBuilder

public static <T,N,P,V> ParserBuilder<T,N,P,V> createParserBuilder(ParserTable<T,N,P,V> table)

createParser

public Parser<T,N,P,V> createParser()

createSimpleParser

public SimpleParser<T> createSimpleParser()

createNoErrorRecoveryPolicy

protected ParserErrorRecoveryPolicy<T,N,P,V> createNoErrorRecoveryPolicy()
Overrides this method if you want to change the warning reporter used by the no error recovery policy.

Returns:
the no error recovery policy with a default warning reporter.
See Also:
ParserErrorRecoveryPolicy.getNoErrorRecoveryPolicy(ParserWarningReporter)

setParserErrorRecoveryListener

public ParserBuilder<T,N,P,V> setParserErrorRecoveryListener(ErrorRecoveryListener<? super T,? super N> errorRecoveryListener)
optional (default is no error recovery)

Parameters:
errorRecoveryListener -

setParserListener

public ParserBuilder<T,N,P,V> setParserListener(ParserListener<? super T,? super N,? super P> listener)
optional (default prints actions on standard error)

Parameters:
listener -

setBranchingParserListener

public ParserBuilder<T,N,P,V> setBranchingParserListener(BranchingParserListener<? super T> branchingListener)
optional (default null)

Parameters:
branchingListener - branching listener

setLookaheadMap

public ParserBuilder<T,N,P,V> setLookaheadMap(LookaheadMap<? extends T,? super V> lookaheadMap)
optional (default is no lookahead map)

Parameters:
lookaheadMap -

setHashLookaheadMap

public ParserBuilder<T,N,P,V> setHashLookaheadMap()
parser table and version (or default) must be set before calling this method.

Returns:
this

setEnumLookaheadMap

public static <T extends Enum<T>,N,P,V extends Enum<V>> ParserBuilder<T,N,P,V> setEnumLookaheadMap(ParserBuilder<T,N,P,V> builder)
parser table must be set before calling this method.

Returns:
this

setParserErrorRecoveryPolicy

public ParserBuilder<T,N,P,V> setParserErrorRecoveryPolicy(ParserErrorRecoveryPolicy<T,N,P,V> policy)
Set the paraesr error recovery policy. optional (default is default policy if there is an error terminal and an error recovery listener, or else no recovery)

Parameters:
policy - an error recovery policy.
Returns:
the current builder.

setStart

public ParserBuilder<T,N,P,V> setStart(N start)
Set the non terminal that will be used to start the parsing. This method is optional (default is default start)

Parameters:
start - a start non terminal.
Returns:
return the current builder.
See Also:
setVersion(Object), getStart()

setVersion

public ParserBuilder<T,N,P,V> setVersion(V version)
Set the version of the grammar that will be use to start the parsing. This method is optional (default is default version)

Parameters:
version - the parsing version, if null the default version will be used.
Returns:
return the current builder.
See Also:
setStart(Object), getVersion()

getErrorRecoveryListener

public ErrorRecoveryListener<? super T,? super N> getErrorRecoveryListener()

getParserListener

public ParserListener<? super T,? super N,? super P> getParserListener()

getBranchingParserListener

public BranchingParserListener<? super T> getBranchingParserListener()

getLookaheadMap

public LookaheadMap<? extends T,? super V> getLookaheadMap()

getParserErrorRecoveryPolicy

public ParserErrorRecoveryPolicy<T,N,P,V> getParserErrorRecoveryPolicy()

getStart

public N getStart()
Returns the starting non termianl of the grammar that will be used to start the parsing.

Returns:
the starting non terminal.
See Also:
setStart(Object)

getParserTable

public ParserTable<T,N,P,V> getParserTable()
Returns the parser table.

Returns:
the parser table.

getVersion

public V getVersion()
Returns the version of the grammar that will be used during parsing.

Returns:
the version of the grammar.
See Also:
setVersion(Object)