Package org.antlr.runtime.debug
Class TraceDebugEventListener
java.lang.Object
org.antlr.runtime.debug.BlankDebugEventListener
org.antlr.runtime.debug.TraceDebugEventListener
- All Implemented Interfaces:
DebugEventListener
Print out (most of) the events... Useful for debugging, testing...
-
Field Summary
FieldsFields inherited from interface org.antlr.runtime.debug.DebugEventListener
FALSE, PROTOCOL_VERSION, TRUE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Make childID a child of rootID.void
becomeRoot
(Object newRoot, Object oldRoot) Make a node the new root of an existing root.void
Input for a tree parser is an AST, but we know nothing for sure about a node except its type and text (obtained from the adaptor).void
createNode
(Object t) Announce a new node built from token elements such as type etc...void
createNode
(Object node, Token token) Announce a new node built from an existing token.void
void
enterSubRule
(int decisionNumber) Track entry into any (...) subrule other EBNF constructvoid
void
exitSubRule
(int decisionNumber) void
location
(int line, int pos) To watch a parser move through the grammar, the parser needs to inform the debugger what line/charPos it is passing in the grammar.void
The tree parser lookedahead.void
A nil was created (even nil nodes have a unique ID...void
setTokenBoundaries
(Object t, int tokenStartIndex, int tokenStopIndex) Set the token start/stop token index for a subtree root or node.Methods inherited from class org.antlr.runtime.debug.BlankDebugEventListener
beginBacktrack, beginResync, commence, consumeHiddenToken, consumeToken, endBacktrack, endResync, enterAlt, enterDecision, enterRule, errorNode, exitDecision, exitRule, LT, mark, recognitionException, rewind, rewind, semanticPredicate, terminate
-
Field Details
-
adaptor
TreeAdaptor adaptor
-
-
Constructor Details
-
TraceDebugEventListener
-
-
Method Details
-
enterRule
-
exitRule
-
enterSubRule
public void enterSubRule(int decisionNumber) Description copied from interface:DebugEventListener
Track entry into any (...) subrule other EBNF construct- Specified by:
enterSubRule
in interfaceDebugEventListener
- Overrides:
enterSubRule
in classBlankDebugEventListener
-
exitSubRule
public void exitSubRule(int decisionNumber) - Specified by:
exitSubRule
in interfaceDebugEventListener
- Overrides:
exitSubRule
in classBlankDebugEventListener
-
location
public void location(int line, int pos) Description copied from interface:DebugEventListener
To watch a parser move through the grammar, the parser needs to inform the debugger what line/charPos it is passing in the grammar. For now, this does not know how to switch from one grammar to the other and back for island grammars etc... This should also allow breakpoints because the debugger can stop the parser whenever it hits this line/pos.- Specified by:
location
in interfaceDebugEventListener
- Overrides:
location
in classBlankDebugEventListener
-
consumeNode
Description copied from interface:DebugEventListener
Input for a tree parser is an AST, but we know nothing for sure about a node except its type and text (obtained from the adaptor). This is the analog of the consumeToken method. Again, the ID is the hashCode usually of the node so it only works if hashCode is not implemented. If the type is UP or DOWN, then the ID is not really meaningful as it's fixed--there is just one UP node and one DOWN navigation node.- Specified by:
consumeNode
in interfaceDebugEventListener
- Overrides:
consumeNode
in classBlankDebugEventListener
- Parameters:
t
-
-
LT
Description copied from interface:DebugEventListener
The tree parser lookedahead. If the type is UP or DOWN, then the ID is not really meaningful as it's fixed--there is just one UP node and one DOWN navigation node.- Specified by:
LT
in interfaceDebugEventListener
- Overrides:
LT
in classBlankDebugEventListener
-
nilNode
Description copied from interface:DebugEventListener
A nil was created (even nil nodes have a unique ID... they are not "null" per se). As of 4/28/2006, this seems to be uniquely triggered when starting a new subtree such as when entering a subrule in automatic mode and when building a tree in rewrite mode. If you are receiving this event over a socket via RemoteDebugEventSocketListener then only t.ID is set.- Specified by:
nilNode
in interfaceDebugEventListener
- Overrides:
nilNode
in classBlankDebugEventListener
-
createNode
Description copied from interface:DebugEventListener
Announce a new node built from token elements such as type etc... If you are receiving this event over a socket via RemoteDebugEventSocketListener then only t.ID, type, text are set.- Specified by:
createNode
in interfaceDebugEventListener
- Overrides:
createNode
in classBlankDebugEventListener
-
createNode
Description copied from interface:DebugEventListener
Announce a new node built from an existing token. If you are receiving this event over a socket via RemoteDebugEventSocketListener then only node.ID and token.tokenIndex are set.- Specified by:
createNode
in interfaceDebugEventListener
- Overrides:
createNode
in classBlankDebugEventListener
-
becomeRoot
Description copied from interface:DebugEventListener
Make a node the new root of an existing root. See Note: the newRootID parameter is possibly different than the TreeAdaptor.becomeRoot() newRoot parameter. In our case, it will always be the result of calling TreeAdaptor.becomeRoot() and not root_n or whatever. The listener should assume that this event occurs only when the current subrule (or rule) subtree is being reset to newRootID. If you are receiving this event over a socket via RemoteDebugEventSocketListener then only IDs are set.- Specified by:
becomeRoot
in interfaceDebugEventListener
- Overrides:
becomeRoot
in classBlankDebugEventListener
- See Also:
-
addChild
Description copied from interface:DebugEventListener
Make childID a child of rootID. If you are receiving this event over a socket via RemoteDebugEventSocketListener then only IDs are set.- Specified by:
addChild
in interfaceDebugEventListener
- Overrides:
addChild
in classBlankDebugEventListener
- See Also:
-
setTokenBoundaries
Description copied from interface:DebugEventListener
Set the token start/stop token index for a subtree root or node. If you are receiving this event over a socket via RemoteDebugEventSocketListener then only t.ID is set.- Specified by:
setTokenBoundaries
in interfaceDebugEventListener
- Overrides:
setTokenBoundaries
in classBlankDebugEventListener
-