public abstract class AbstractLexerBlockResolver extends Object implements LexerBlockResolver
Constructor and Description |
---|
AbstractLexerBlockResolver() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
computeSafeMode()
Computes if safe mode should be activated or not when calling
identify(LexerParser)
or identifyAndConsume(LexerParser) . |
void |
consume(LexerParser parser)
Indicates that this parser has been consumed.
|
LexerParser |
identify(LexerParser parentParser)
Should Calls
LexerBlockResolver.identify(LexerParser, boolean)
with safe mode computed from unicity, mandatory flag min/max occur and already consumed parsers. |
LexerParser |
identify(LexerParser parentParser,
boolean safeMode)
Identifies the lexer to use between candidates identified by
LexerBlockResolver.resolveLexers(Grammar) to handle the following source part. |
LexerParser |
identifyAndConsume(LexerParser parentParser)
Short cut to call both identity and consume
|
LexerParser |
identifyAndConsume(LexerParser parentParser,
boolean safeMode)
Short cut to call both identity and consume
|
protected abstract List<Lexer> |
internalResolveLexers(Grammar grammar)
Called to effectively resolve lexers list after unicity and max occur checks have been done.
|
boolean |
isHasBeenConsumed() |
boolean |
isMaxConsommationReached() |
boolean |
isMinConsommationReached() |
List<Lexer> |
resolveLexers(Grammar grammar)
Checks that this resolver has not been fully consumed and calls
internalResolveLexers(Grammar) . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBlock, inject, isExcluded
public List<Lexer> resolveLexers(Grammar grammar) throws DslException
internalResolveLexers(Grammar)
.resolveLexers
in interface LexerBlockResolver
DslException
protected abstract List<Lexer> internalResolveLexers(Grammar grammar) throws DslException
DslException
public LexerParser identify(LexerParser parentParser) throws IOException, DslException
LexerBlockResolver
LexerBlockResolver.identify(LexerParser, boolean)
with safe mode computed from unicity, mandatory flag min/max occur and already consumed parsers.identify
in interface LexerBlockResolver
IOException
DslException
public LexerParser identify(LexerParser parentParser, boolean safeMode) throws IOException, DslException
LexerBlockResolver
LexerBlockResolver.resolveLexers(Grammar)
to handle the following source part.identify
in interface LexerBlockResolver
parentParser
- Parent parsersafeMode
- If false, an exception will be thrown if no lexer is identifiedIOException
DslException
public LexerParser identifyAndConsume(LexerParser parentParser) throws IOException, DslException
LexerBlockResolver
identifyAndConsume
in interface LexerBlockResolver
IOException
DslException
public LexerParser identifyAndConsume(LexerParser parentParser, boolean safeMode) throws IOException, DslException
LexerBlockResolver
identifyAndConsume
in interface LexerBlockResolver
IOException
DslException
public void consume(LexerParser parser) throws DslException
LexerBlockResolver
consume
in interface LexerBlockResolver
DslException
public boolean isHasBeenConsumed()
isHasBeenConsumed
in interface LexerBlockResolver
public boolean isMinConsommationReached()
isMinConsommationReached
in interface LexerBlockResolver
public boolean isMaxConsommationReached()
isMaxConsommationReached
in interface LexerBlockResolver
protected boolean computeSafeMode()
identify(LexerParser)
or identifyAndConsume(LexerParser)
.isMinConsommationReached()
only.