| java.lang.Object fri.patterns.interpreter.parsergenerator.lexer.Consumer fri.patterns.interpreter.parsergenerator.lexer.ConsumerAlternatives
ConsumerAlternatives | class ConsumerAlternatives extends Consumer (Code) | | Container for alternative rules/Consumers.
If one of the contained consumers succeeds, the
alternative succeeds, else it fails.
author: (c) 2002, Fritz Ritzberger |
Method Summary | |
public void | addAlternate(Consumer alternateConsumer) Add another alternative consumer for same nonterminal. | protected ResultTree | consumeInternal(InputText input) Reads from input by delegating to a Strategy object.
Parameters: input - Input object where to read from. | public List | getAlternatives() Returns the stored alternative consumers that have the same nonterminal.
This is for the Lexer to retrieve alternative consumers and call them
explicitely to read input. | protected int | getSomeLength(boolean exploreStartLength, List breakIndicator) Returns the maximum fixed length of all alternating consumers. | public Character | getStartCharacter() Returns the common start character if all alternatives have the same, else null. | public int | getStartVariance() Returns 1 if start character exists, else the sum of possible start variances of all consumers
(silently assuming that they have different character sets). | boolean | matchesRepeatableRule(Rule rule) Tries to match to all alternates. | public boolean | overlaps(Consumer cc) Returns true if the passed consumer could be concurrent with one of the contained alternatives. | public void | setStrategyFactoryMethod(StrategyFactoryMethod strategyFactoryMethod) Sets the factory for Strategy objects. | protected String | toStringBase() Returns the base string for toString() method. |
ConsumerAlternatives | ConsumerAlternatives(Consumer alternateConsumer)(Code) | | Create a list of alternative consumers, inserting passed consumer.
|
addAlternate | public void addAlternate(Consumer alternateConsumer)(Code) | | Add another alternative consumer for same nonterminal.
|
consumeInternal | protected ResultTree consumeInternal(InputText input) throws IOException(Code) | | Reads from input by delegating to a Strategy object.
Parameters: input - Input object where to read from. null if no match, else scanned input as a StringBuffer. |
getAlternatives | public List getAlternatives()(Code) | | Returns the stored alternative consumers that have the same nonterminal.
This is for the Lexer to retrieve alternative consumers and call them
explicitely to read input. This must be done to match the longest input.
|
getSomeLength | protected int getSomeLength(boolean exploreStartLength, List breakIndicator)(Code) | | Returns the maximum fixed length of all alternating consumers.
A fixed start sequence ends at the first found character set (like "0..9").
Returns the maximum start length of all alternating consumers.
A consumer start length ends at the first found repeatable or nullable consumer (like "chars*").
|
getStartCharacter | public Character getStartCharacter()(Code) | | Returns the common start character if all alternatives have the same, else null.
|
getStartVariance | public int getStartVariance()(Code) | | Returns 1 if start character exists, else the sum of possible start variances of all consumers
(silently assuming that they have different character sets).
|
matchesRepeatableRule | boolean matchesRepeatableRule(Rule rule)(Code) | | Tries to match to all alternates. Returns true when at least one succeeds.
|
overlaps | public boolean overlaps(Consumer cc)(Code) | | Returns true if the passed consumer could be concurrent with one of the contained alternatives.
|
setStrategyFactoryMethod | public void setStrategyFactoryMethod(StrategyFactoryMethod strategyFactoryMethod)(Code) | | Sets the factory for Strategy objects.
|
toStringBase | protected String toStringBase()(Code) | | Returns the base string for toString() method.
|
|
|