fr.umlv.tatoo.runtime.tools.builder
Class LexerBuilder<R,B extends LexerBuffer>

java.lang.Object
  extended by fr.umlv.tatoo.runtime.tools.builder.LexerBuilder<R,B>

public class LexerBuilder<R,B extends LexerBuffer>
extends Object


Constructor Summary
protected LexerBuilder(LexerTable<R> table)
           
 
Method Summary
protected  RuleActivator<R> createAllRuleActivator(LexerTable<R> table)
          Creates a rule activator that activate all rules.
static
<R,B extends LexerBuffer>
LexerBuilder<R,B>
createBuilder(LexerTable<R> table, B buffer)
           
protected  LexerErrorRecoveryPolicy<R,B> createDefaultPolicy(ErrorForwarder<B> forwarder)
           
 Lexer<B> createLexer()
           
protected
<T> ParserForwarder<T,B>
createParserForwarder(SimpleParser<T> parser)
           
static
<R> LexerBuilder<R,ReaderWrapper>
createReaderBuilder(LexerTable<R> table, Reader reader)
           
 SimpleLexer createSimpleLexer()
           
 RuleActivator<R> getActivator()
           
 B getBuffer()
           
 ErrorForwarder<B> getForwarder()
           
 LexerErrorRecoveryPolicy<R,B> getLexerErrorPolicy()
           
 LexerListener<? super R,? super B> getLexerListener()
           
 LexerTable<R> getLexerTable()
           
 LifecycleHandler<B> getLifecycleHandler()
           
 LexerBuilder<R,B> setActivator(RuleActivator<R> activator)
          optional (all rules by default)
 LexerBuilder<R,B> setBuffer(B buffer)
          optional, but if null the buffer have to be given to the lexer using Lexer.reset(B)
 LexerBuilder<R,B> setForwarder(ErrorForwarder<B> forwarder)
          optional (DefaultErrorForwarder i.e. nothing or set by setParser by default)
 void setLexerErrorPolicy(LexerErrorRecoveryPolicy<R,B> policy)
           
 LexerBuilder<R,B> setLexerListener(LexerListener<? super R,? super B> listener)
          optional (logging listener by default)
 LexerBuilder<R,B> setLifecycleHandler(LifecycleHandler<B> lifecycleHandler)
          optionnal (null i.e. nothing or set by setParser by default)
<T,N,P,V> LexerBuilder<R,B>
setParser(SimpleParser<T> parser)
          sets parser forwarder and lifecycle handler forwarding to the parser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LexerBuilder

protected LexerBuilder(LexerTable<R> table)
Method Detail

createBuilder

public static <R,B extends LexerBuffer> LexerBuilder<R,B> createBuilder(LexerTable<R> table,
                                                                        B buffer)

createReaderBuilder

public static <R> LexerBuilder<R,ReaderWrapper> createReaderBuilder(LexerTable<R> table,
                                                                    Reader reader)

createSimpleLexer

public SimpleLexer createSimpleLexer()

createLexer

public Lexer<B> createLexer()

setBuffer

public LexerBuilder<R,B> setBuffer(B buffer)
optional, but if null the buffer have to be given to the lexer using Lexer.reset(B)

Parameters:
buffer -

setLexerListener

public LexerBuilder<R,B> setLexerListener(LexerListener<? super R,? super B> listener)
optional (logging listener by default)

Parameters:
listener -

setActivator

public LexerBuilder<R,B> setActivator(RuleActivator<R> activator)
optional (all rules by default)

Parameters:
activator - may be null, in that case all rules are activated

createAllRuleActivator

protected RuleActivator<R> createAllRuleActivator(LexerTable<R> table)
Creates a rule activator that activate all rules. This method is called by createLexer() if not activator is set.

Parameters:
table - the parser table, never null.
See Also:
LexerTable.getRuleDataMap()

setLifecycleHandler

public LexerBuilder<R,B> setLifecycleHandler(LifecycleHandler<B> lifecycleHandler)
optionnal (null i.e. nothing or set by setParser by default)

Parameters:
lifecycleHandler -

setForwarder

public LexerBuilder<R,B> setForwarder(ErrorForwarder<B> forwarder)
optional (DefaultErrorForwarder i.e. nothing or set by setParser by default)

Parameters:
forwarder -

setLexerErrorPolicy

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

createDefaultPolicy

protected LexerErrorRecoveryPolicy<R,B> createDefaultPolicy(ErrorForwarder<B> forwarder)

setParser

public <T,N,P,V> LexerBuilder<R,B> setParser(SimpleParser<T> parser)
sets parser forwarder and lifecycle handler forwarding to the parser

Parameters:
parser -
Returns:
this
See Also:
createParserForwarder(fr.umlv.tatoo.runtime.parser.SimpleParser)

createParserForwarder

protected <T> ParserForwarder<T,B> createParserForwarder(SimpleParser<T> parser)

getActivator

public RuleActivator<R> getActivator()

getBuffer

public B getBuffer()

getForwarder

public ErrorForwarder<B> getForwarder()

getLifecycleHandler

public LifecycleHandler<B> getLifecycleHandler()

getLexerListener

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

getLexerTable

public LexerTable<R> getLexerTable()

getLexerErrorPolicy

public LexerErrorRecoveryPolicy<R,B> getLexerErrorPolicy()