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

java.lang.Object
  extended by fr.umlv.tatoo.runtime.tools.builder.Builder.LexerBuilder<R,B>
Type Parameters:
R - type of rules.
B - type of the buffer.
Enclosing class:
Builder

public static class Builder.LexerBuilder<R,B extends LexerBuffer>
extends Object

A lexer builder that is able to set an activator, create a lexer or create a new builder in expert mode.


Method Summary
 Builder.LexerBuilder<R,B> activator(RuleActivator<R> activator)
          Set a rule activator.
 Builder.LexerBuilder<R,B> allRuleActivator()
          Set a rule activator that will activate all rules at any time.
 Lexer<B> create()
          Creates a lexer with all rule activated if no activator is provided, the default error handling policy and no lifecycle handler.
 Builder.ExpertLexerBuilder<R,B> expert()
          Returns a lexer builder with more configuration options.
 Builder.LexerBuilder<R,B> trace()
          Adds a debug proxy in front of the lexer listener that will trace all calls to the lexer listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

allRuleActivator

public Builder.LexerBuilder<R,B> allRuleActivator()
Set a rule activator that will activate all rules at any time.

Returns:
this builder.
See Also:
activator(RuleActivator)

activator

public Builder.LexerBuilder<R,B> activator(RuleActivator<R> activator)
Set a rule activator. A rule activator is called by the lexer each time a new token is about to be recognized. The rule activator returns the rule that can be used by the lexer in that context. The context is not provided by the lexer, it's up to the rule activator to maintain such context.

Parameters:
activator - a rule activator
Returns:
this builder.

trace

public Builder.LexerBuilder<R,B> trace()
Adds a debug proxy in front of the lexer listener that will trace all calls to the lexer listener

Returns:
a lexer builder with a lexer listener wrapped by a trace proxy.

expert

public Builder.ExpertLexerBuilder<R,B> expert()
Returns a lexer builder with more configuration options. If no rule activator was previously set, a rule activator that activate all rules will be configured.

Returns:
a lexer builder with more configuration options.

create

public Lexer<B> create()
Creates a lexer with all rule activated if no activator is provided, the default error handling policy and no lifecycle handler.

See Also:
allRuleActivator(), Builder.ExpertLexerBuilder.defaultErrorPolicy(LexerWarningReporter)