Package org.nineml.coffeegrinder.trees
Interface TreeBuilder
-
- All Known Implementing Classes:
GenericTreeBuilder,NopTreeBuilder,PrintStreamTreeBuilder,StdoutTreeBuilder,StringTreeBuilder
public interface TreeBuilderThe tree builder interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidendAmbiguity(int id, int leftExtent, int rightExtent)Called at the end of an ambiguity that is not marked by a single nonterminal.voidendNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)Called when a nonterminal ends.voidendTree(boolean ambiguous, boolean absolutelyAmbiguous, boolean infinitelyAmbiguous)Called last, when construction finishes.voidstartAmbiguity(int id, int leftExtent, int rightExtent)Called at the start of an ambiguity that is not marked by a single nonterminal.voidstartNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)Called when a new nonterminal begins.voidstartTree()Called first, when construction begins.voidtoken(Token token, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)Called when a terminal occurs.
-
-
-
Method Detail
-
startTree
void startTree()
Called first, when construction begins.
-
endTree
void endTree(boolean ambiguous, boolean absolutelyAmbiguous, boolean infinitelyAmbiguous)Called last, when construction finishes.- Parameters:
ambiguous- was the parse ambiguous?absolutelyAmbiguous- is the graph ambiguous?infinitelyAmbiguous- is the graph infinitely ambiguous?
-
startNonterminal
void startNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
Called when a new nonterminal begins.- Parameters:
symbol- The symbol.attributes- Its attributes.leftExtent- The starting position in the input.rightExtent- The ending position in the input.
-
endNonterminal
void endNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
Called when a nonterminal ends.- Parameters:
symbol- The symbol.attributes- Its attributes.leftExtent- The starting position in the input.rightExtent- The ending position in the input.
-
token
void token(Token token, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
Called when a terminal occurs.- Parameters:
token- The terminal token.attributes- Its attributes.leftExtent- The starting position in the input.rightExtent- The ending position in the input.
-
startAmbiguity
void startAmbiguity(int id, int leftExtent, int rightExtent)Called at the start of an ambiguity that is not marked by a single nonterminal.The ambiguity id will distinguish this ambiguity from any other ambiguity. The numbers are not sequential or guaranteed stable across parses.
- Parameters:
id- The ambiguity id.leftExtent- The starting position in the input.rightExtent- The ending position in the input.
-
endAmbiguity
void endAmbiguity(int id, int leftExtent, int rightExtent)Called at the end of an ambiguity that is not marked by a single nonterminal.- Parameters:
id- The ambiguity id.leftExtent- The starting position in the input.rightExtent- The ending position in the input.
-
-