|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fri.patterns.interpreter.parsergenerator.lexer.Strategy
Strategy is the way how alternative concurrent character consumers are applied to input. It is used by LexerImpl and ConsumerAlternatives. There are consumers that have a fixed start character and others that have not. Consumers have different length of fixed start sequences. Some consumers have a fixed length to scan, others (with repeatable rules) have not. Consumers differ in their character sets, some having many possible characters, others lesser, some sets might overlap those of other consumers. Last but not least the Parser gives hints about currently expected tokens.
Following is the strategy implemented here:
Nested Class Summary | |
static class |
Strategy.Item
The List item wrapper for toplevel consumers. |
Constructor Summary | |
Strategy()
|
Method Summary | |
void |
addIgnoringConsumer(java.lang.String symbol,
fri.patterns.interpreter.parsergenerator.lexer.Consumer cc)
Adds a Consumer to list of possible consumers. |
void |
addTokenConsumer(java.lang.String symbol,
fri.patterns.interpreter.parsergenerator.lexer.Consumer cc)
Adds a Consumer to list of possible consumers producing valid tokens. |
Strategy.Item |
consume(fri.patterns.interpreter.parsergenerator.lexer.InputText input,
int lookahead,
java.util.Map expectedTokenSymbols)
Liefert null wenn kein consumer den input lesen kann, sonst den laengstmoeglichen gescannten Text. |
boolean |
hasTerminal(java.lang.String terminal)
Returns true if the passed terminal is already in list. |
void |
setCompeteForLongestInput(boolean competeForLongestInput)
|
java.lang.String |
toString()
Returns a human readable representation of the lists and maps within this strategy. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Strategy()
Method Detail |
public void setCompeteForLongestInput(boolean competeForLongestInput)
public void addIgnoringConsumer(java.lang.String symbol, fri.patterns.interpreter.parsergenerator.lexer.Consumer cc)
public void addTokenConsumer(java.lang.String symbol, fri.patterns.interpreter.parsergenerator.lexer.Consumer cc)
public boolean hasTerminal(java.lang.String terminal)
public Strategy.Item consume(fri.patterns.interpreter.parsergenerator.lexer.InputText input, int lookahead, java.util.Map expectedTokenSymbols) throws java.io.IOException
input
- the input to read fromlookahead
- the first byte or character from inputexpectedTokenSymbols
- expected token symbols (in key enumeration), can be null
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |