Package eu.bandm.tools.d2d2.base
Class StackPrinter
java.lang.Object
eu.bandm.tools.d2d2.base.StackPrinter
Prints the current stack state to a terminal, highlighting current
position and possible continuations, for error diagnosis in interactive
use cases.
ATTENTION: All methods in this context operate on the OBJECT IDENTITY of reference expressions, etc., thus identifying POSITIONS in complex expressions by object "==". This is only allowed in such a temporary "frozen" context.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Simply prints expressions, inserting parentheses by priority.protected static class
Single-use tool to find all sub-expressions of the current content model which are allowed to enter as next input in the current parsing situation. -
Field Summary
Modifier and TypeFieldDescriptionprotected Reference
Holds the last reference which has been entered and is stored in the next-lower State_singleton.(package private) Set<Expression>
Holds all references the tags of which could be entered in the current parsing state.protected String
Separator between the print-out of the name or symbol of a parser state and its highlighted content model.protected DiagnosisMarkUp
Determines the optical appearance of current tag and possible subsequen tags.protected PrintWriter
Target of the print-out.protected boolean
Whether states will be printed which do not correspond to an element's content model but to an anonymous collection expression. -
Constructor Summary
ModifierConstructorDescriptionprotected
Default constructor: assumes aVt100
terminal and output to std-err.protected
StackPrinter
(DiagnosisMarkUp markup) Constructor with explicit selection of highlighting control.protected
StackPrinter
(DiagnosisMarkUp markup, PrintWriter pw) Constructor with explicit selection of highlighting control and output target. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doPrintStack
(State state) Worker method for printing one state of a parser state stack.protected String
Delivers the name of the referred defintion to represent a reference expression.protected void
Print a tag in the context of a parser state print-out.void
printStack
(State state) Print one state of the parser state.void
printStack
(State state, boolean showIntermediate) Print one state of the parser state.protected String
stateLabel
(State s) The printed identification of a parser frame.
-
Field Details
-
markup
Determines the optical appearance of current tag and possible subsequen tags. -
printwriter
Target of the print-out. -
headerSeparatorString
Separator between the print-out of the name or symbol of a parser state and its highlighted content model. -
showIntermediate
protected boolean showIntermediateWhether states will be printed which do not correspond to an element's content model but to an anonymous collection expression. -
activeRef
Holds the last reference which has been entered and is stored in the next-lower State_singleton. Causes highlighting. -
followset
Set<Expression> followsetHolds all references the tags of which could be entered in the current parsing state. Causes highlighting. May contain tags/references and the special pseudo reference to pcdata.
-
-
Constructor Details
-
StackPrinter
protected StackPrinter()Default constructor: assumes aVt100
terminal and output to std-err. -
StackPrinter
Constructor with explicit selection of highlighting control. Assumes output to std-err. -
StackPrinter
Constructor with explicit selection of highlighting control and output target.
-
-
Method Details
-
stateLabel
The printed identification of a parser frame. Either the name of an elemente reference or a symbol for an intermediate collection expression. -
print
Print a tag in the context of a parser state print-out.- Parameters:
text
- to printactive
- whether the element is currently open in the parser statepossible
- whether the element is an allowed input in the parser state
-
printStack
Print one state of the parser state. The states are defined inText2Udom
. This method is a service access point and can be called from outside. -
printStack
Print one state of the parser state. The states are defined inText2Udom
. This method is a service access point and can be called from outside.- Parameters:
showIntermediate
- whether states will be printed which do not correspond to an element's content model but to an anonymous collection expression.
-
doPrintStack
Worker method for printing one state of a parser state stack. -
getRefTag
Delivers the name of the referred defintion to represent a reference expression.
-