fr.umlv.tatoo.runtime.tools.builder
Class ToolsBuilder<R,B extends LexerBuffer,T,N,P,V,S extends ToolsBuilder<R,B,T,N,P,V,S>>

java.lang.Object
  extended by fr.umlv.tatoo.runtime.tools.builder.ToolsBuilder<R,B,T,N,P,V,S>

public abstract class ToolsBuilder<R,B extends LexerBuffer,T,N,P,V,S extends ToolsBuilder<R,B,T,N,P,V,S>>
extends Object


Constructor Summary
protected ToolsBuilder(LexerBuilder<R,B> lexerBuilder, ParserBuilder<T,N,P,V> parserBuilder)
           
 
Method Summary
 Lexer<B> createLexer()
          Creates a parser and a lexer linked to the parser but doesn't provide a reference on the created parser.
abstract  LexerAndParser<B,T,N,P,V> createLexerAndParser()
          Creates a parser and a lexer linked to the parser.
 RuleActivator<R> getActivator()
           
 BranchingParserListener<? super T> getBranchingParserListener()
           
 B getBuffer()
           
 ErrorRecoveryListener<? super T,? super N> getErrorRecoveryListener()
           
 ErrorForwarder<B> getForwarder()
           
protected  LexerBuilder<R,B> getLexerBuilder()
          Export the underlying lexer builder to subclass.
 LexerErrorRecoveryPolicy<R,B> getLexerErrorPolicy()
           
 LexerListener<? super R,? super B> getLexerListener()
           
 LexerTable<R> getLexerTable()
           
 LifecycleHandler<B> getLifecycleHandler()
           
 LookaheadMap<? extends T,? super V> getLookaheadMap()
           
protected  ParserBuilder<T,N,P,V> getParserBuilder()
          Export the underlying parser builder to subclass.
 ParserErrorRecoveryPolicy<T,N,P,V> getParserErrorRecoveryPolicy()
           
 ParserListener<? super T,? super N,? super P> getParserListener()
           
 ParserTable<T,N,P,V> getParserTable()
           
 GenericStack getSemanticStack()
          Returns the semantic stack that will be shared by all parser created by this builder.
 N getStart()
           
 V getVersion()
           
protected abstract  S self()
           
 S setActivator(RuleActivator<R> activator)
           
 S setBranchingParserListener(BranchingParserListener<? super T> branchingListener)
           
 S setBuffer(B buffer)
           
static
<T extends Enum<T>,N,P,V extends Enum<V>,S extends ToolsBuilder<?,?,T,N,P,V,S>>
S
setEnumLookaheadMap(S builder)
           
 S setErrorRecoveryListener(ErrorRecoveryListener<? super T,? super N> errorRecoveryListener)
           
 S setForwarder(ErrorForwarder<B> forwarder)
           
 S setHashLookaheadMap()
           
 S setLexerErrorPolicy(LexerErrorRecoveryPolicy<R,B> policy)
           
 S setLexerListener(LexerListener<? super R,? super B> listener)
           
 S setLifecycleHandler(LifecycleHandler<B> lifecycleHandler)
           
 S setLookaheadMap(LookaheadMap<? extends T,? super V> lookaheadMap)
           
 S setParserErrorRecoveryPolicy(ParserErrorRecoveryPolicy<T,N,P,V> policy)
           
 S setParserListener(ParserListener<? super T,? super N,? super P> listener)
           
 S setSemanticStack(GenericStack semanticStack)
          Set the stack that will be used by the parser processor.
 S setStart(N start)
           
 S setVersion(V version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolsBuilder

protected ToolsBuilder(LexerBuilder<R,B> lexerBuilder,
                       ParserBuilder<T,N,P,V> parserBuilder)
Method Detail

self

protected abstract S self()

getActivator

public RuleActivator<R> getActivator()

getBuffer

public B getBuffer()

getForwarder

public ErrorForwarder<B> getForwarder()

getLexerListener

public LexerListener<? super R,? super B> getLexerListener()

getLexerTable

public LexerTable<R> getLexerTable()

getLifecycleHandler

public LifecycleHandler<B> getLifecycleHandler()

getLexerErrorPolicy

public LexerErrorRecoveryPolicy<R,B> getLexerErrorPolicy()

setLexerErrorPolicy

public S setLexerErrorPolicy(LexerErrorRecoveryPolicy<R,B> policy)

setActivator

public S setActivator(RuleActivator<R> activator)

setBuffer

public S setBuffer(B buffer)

setForwarder

public S setForwarder(ErrorForwarder<B> forwarder)

setLexerListener

public S setLexerListener(LexerListener<? super R,? super B> listener)

setLifecycleHandler

public S setLifecycleHandler(LifecycleHandler<B> lifecycleHandler)

setEnumLookaheadMap

public static <T extends Enum<T>,N,P,V extends Enum<V>,S extends ToolsBuilder<?,?,T,N,P,V,S>> S setEnumLookaheadMap(S builder)

getErrorRecoveryListener

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

getLookaheadMap

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

getParserErrorRecoveryPolicy

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

getParserListener

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

getBranchingParserListener

public BranchingParserListener<? super T> getBranchingParserListener()

getStart

public N getStart()

getParserTable

public ParserTable<T,N,P,V> getParserTable()

getVersion

public V getVersion()

getSemanticStack

public GenericStack getSemanticStack()
Returns the semantic stack that will be shared by all parser created by this builder.

Returns:
the semantic stack.

setErrorRecoveryListener

public S setErrorRecoveryListener(ErrorRecoveryListener<? super T,? super N> errorRecoveryListener)

setHashLookaheadMap

public S setHashLookaheadMap()

setLookaheadMap

public S setLookaheadMap(LookaheadMap<? extends T,? super V> lookaheadMap)

setParserErrorRecoveryPolicy

public S setParserErrorRecoveryPolicy(ParserErrorRecoveryPolicy<T,N,P,V> policy)

setParserListener

public S setParserListener(ParserListener<? super T,? super N,? super P> listener)

setBranchingParserListener

public S setBranchingParserListener(BranchingParserListener<? super T> branchingListener)

setStart

public S setStart(N start)

setVersion

public S setVersion(V version)

setSemanticStack

public S setSemanticStack(GenericStack semanticStack)
Set the stack that will be used by the parser processor.

Parameters:
semanticStack - the semantic stack or null.
Returns:
the current builder.

getLexerBuilder

protected final LexerBuilder<R,B> getLexerBuilder()
Export the underlying lexer builder to subclass.

Returns:
a lexer builder.

getParserBuilder

protected final ParserBuilder<T,N,P,V> getParserBuilder()
Export the underlying parser builder to subclass.

Returns:
a parser builder.

createLexerAndParser

public abstract LexerAndParser<B,T,N,P,V> createLexerAndParser()
Creates a parser and a lexer linked to the parser. The created lexer and parser can be retrieved by using respectively LexerAndParser.getLexer() or LexerAndParser.getParser(). The lexer a the parser a created using the values of the current builder.

Returns:
a new lexer and parser.

createLexer

public Lexer<B> createLexer()
Creates a parser and a lexer linked to the parser but doesn't provide a reference on the created parser. The lexer a the parser a created using the values of the current builder.

Returns:
a new lexer linked to a parser.