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
Nested ClassesModifier and TypeClassDescriptionprotected static classSimply prints expressions, inserting parentheses by priority.protected static classSingle-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
FieldsModifier and TypeFieldDescriptionprotected ReferenceHolds 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 StringSeparator between the print-out of the name or symbol of a parser state and its highlighted content model.protected DiagnosisMarkUpDetermines the optical appearance of current tag and possible subsequen tags.protected PrintWriterTarget of the print-out.protected booleanWhether states will be printed which do not correspond to an element's content model but to an anonymous collection expression. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor: assumes aVt100terminal and output to std-err.protectedStackPrinter(DiagnosisMarkUp markup) Constructor with explicit selection of highlighting control.protectedStackPrinter(DiagnosisMarkUp markup, PrintWriter pw) Constructor with explicit selection of highlighting control and output target. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoPrintStack(State state) Worker method for printing one state of a parser state stack.protected StringDelivers the name of the referred defintion to represent a reference expression.protected voidPrint a tag in the context of a parser state print-out.voidprintStack(State state) Print one state of the parser state.voidprintStack(State state, boolean showIntermediate) Print one state of the parser state.protected StringstateLabel(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 aVt100terminal 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.
-