public class PrintStreamTreeBuilder extends java.lang.Object implements TreeBuilder
Constructor and Description |
---|
PrintStreamTreeBuilder(java.io.PrintStream stream) |
PrintStreamTreeBuilder(java.io.PrintStream stream,
boolean addTrailingNewline) |
Modifier and Type | Method and Description |
---|---|
void |
endAmbiguity(int id,
int leftExtent,
int rightExtent)
Called at the end of an ambiguity that is not marked by a single nonterminal.
|
void |
endNonterminal(NonterminalSymbol symbol,
java.util.Map<java.lang.String,java.lang.String> attributes,
int leftExtent,
int rightExtent)
Called when a nonterminal ends.
|
void |
endTree(boolean ambiguous,
boolean absolutelyAmbiguous,
boolean infinitelyAmbiguous)
Called last, when construction finishes.
|
void |
startAmbiguity(int id,
int leftExtent,
int rightExtent)
Called at the start of an ambiguity that is not marked by a single nonterminal.
|
void |
startNonterminal(NonterminalSymbol symbol,
java.util.Map<java.lang.String,java.lang.String> attributes,
int leftExtent,
int rightExtent)
Called when a new nonterminal begins.
|
void |
startTree()
Called first, when construction begins.
|
void |
token(Token token,
java.util.Map<java.lang.String,java.lang.String> attributes,
int leftExtent,
int rightExtent)
Called when a terminal occurs.
|
public PrintStreamTreeBuilder(java.io.PrintStream stream)
public PrintStreamTreeBuilder(java.io.PrintStream stream, boolean addTrailingNewline)
public void startTree()
TreeBuilder
startTree
in interface TreeBuilder
public void endTree(boolean ambiguous, boolean absolutelyAmbiguous, boolean infinitelyAmbiguous)
TreeBuilder
endTree
in interface TreeBuilder
ambiguous
- was the parse ambiguous?absolutelyAmbiguous
- is the graph ambiguous?infinitelyAmbiguous
- is the graph infinitely ambiguous?public void startNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
TreeBuilder
startNonterminal
in interface TreeBuilder
symbol
- The symbol.attributes
- Its attributes.leftExtent
- The starting position in the input.rightExtent
- The ending position in the input.public void endNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
TreeBuilder
endNonterminal
in interface TreeBuilder
symbol
- The symbol.attributes
- Its attributes.leftExtent
- The starting position in the input.rightExtent
- The ending position in the input.public void token(Token token, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
TreeBuilder
token
in interface TreeBuilder
token
- The terminal token.attributes
- Its attributes.leftExtent
- The starting position in the input.rightExtent
- The ending position in the input.public void startAmbiguity(int id, int leftExtent, int rightExtent)
TreeBuilder
The ambiguity id will distinguish this ambiguity from any other ambiguity. The numbers are not sequential or guaranteed stable across parses.
startAmbiguity
in interface TreeBuilder
id
- The ambiguity id.leftExtent
- The starting position in the input.rightExtent
- The ending position in the input.public void endAmbiguity(int id, int leftExtent, int rightExtent)
TreeBuilder
endAmbiguity
in interface TreeBuilder
id
- The ambiguity id.leftExtent
- The starting position in the input.rightExtent
- The ending position in the input.