|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.antlr.runtime.debug.BlankDebugEventListener
org.antlr.runtime.debug.DebugEventSocketProxy
public class DebugEventSocketProxy
A proxy debug event listener that forwards events over a socket to a debugger (or any other listener) using a simple text-based protocol; one event per line. ANTLRWorks listens on server socket with a RemoteDebugEventSocketListener instance. These two objects must therefore be kept in sync. New events must be handled on both sides of socket.
| Field Summary | |
|---|---|
protected TreeAdaptor |
adaptor
Almost certainly the recognizer will have adaptor set, but we don't know how to cast it (Parser or TreeParser) to get the adaptor field. |
static int |
DEFAULT_DEBUGGER_PORT
|
protected String |
grammarFileName
|
protected BufferedReader |
in
|
protected PrintWriter |
out
|
protected int |
port
|
protected BaseRecognizer |
recognizer
Who am i debugging? |
protected ServerSocket |
serverSocket
|
protected Socket |
socket
|
| Fields inherited from interface org.antlr.runtime.debug.DebugEventListener |
|---|
FALSE, PROTOCOL_VERSION, TRUE |
| Constructor Summary | |
|---|---|
DebugEventSocketProxy(BaseRecognizer recognizer,
int port,
TreeAdaptor adaptor)
|
|
DebugEventSocketProxy(BaseRecognizer recognizer,
TreeAdaptor adaptor)
|
|
| Method Summary | |
|---|---|
protected void |
ack()
|
void |
addChild(Object root,
Object child)
Make childID a child of rootID. |
void |
becomeRoot(Object newRoot,
Object oldRoot)
Make a node the new root of an existing root. |
void |
beginBacktrack(int level)
|
void |
beginResync()
Indicates the recognizer is about to consume tokens to resynchronize the parser. |
void |
commence()
Announce that parsing has begun. |
void |
consumeHiddenToken(Token t)
An off-channel input token was consumed. |
void |
consumeNode(Object t)
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 |
consumeToken(Token t)
An input token was consumed; matched by any kind of element. |
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 |
endBacktrack(int level,
boolean successful)
|
void |
endResync()
Indicates that the recognizer has finished consuming tokens in order to resychronize. |
void |
enterAlt(int alt)
Because rules can have lots of alternatives, it is very useful to know which alt you are entering. |
void |
enterDecision(int decisionNumber,
boolean couldBacktrack)
Every decision, fixed k or arbitrary, has an enter/exit event so that a GUI can easily track what LT/consume events are associated with prediction. |
void |
enterRule(String grammarFileName,
String ruleName)
The parser has just entered a rule. |
void |
enterSubRule(int decisionNumber)
Track entry into any (...) subrule other EBNF construct |
void |
errorNode(Object t)
Upon syntax error, recognizers bracket the error with an error node if they are building ASTs. |
protected String |
escapeNewlines(String txt)
|
void |
exitDecision(int decisionNumber)
|
void |
exitRule(String grammarFileName,
String ruleName)
This is the last thing executed before leaving a rule. |
void |
exitSubRule(int decisionNumber)
|
TreeAdaptor |
getTreeAdaptor()
|
void |
handshake()
|
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 |
LT(int i,
Object t)
The tree parser lookedahead. |
void |
LT(int i,
Token t)
Somebody (anybody) looked ahead. |
void |
mark(int i)
The parser is going to look arbitrarily ahead; mark this location, the token stream's marker is sent in case you need it. |
void |
nilNode(Object t)
A nil was created (even nil nodes have a unique ID... |
void |
recognitionException(RecognitionException e)
A recognition exception occurred such as NoViableAltException. |
void |
rewind()
Rewind to the input position of the last marker. |
void |
rewind(int i)
After an arbitrairly long lookahead as with a cyclic DFA (or with any backtrack), this informs the debugger that stream should be rewound to the position associated with marker. |
void |
semanticPredicate(boolean result,
String predicate)
A semantic predicate was evaluate with this result and action text |
protected void |
serializeNode(StringBuffer buf,
Object t)
|
protected void |
serializeText(StringBuffer buf,
String text)
|
protected String |
serializeToken(Token t)
|
void |
setTokenBoundaries(Object t,
int tokenStartIndex,
int tokenStopIndex)
Set the token start/stop token index for a subtree root or node. |
void |
setTreeAdaptor(TreeAdaptor adaptor)
|
void |
terminate()
Parsing is over; successfully or not. |
protected void |
transmit(String event)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_DEBUGGER_PORT
protected int port
protected ServerSocket serverSocket
protected Socket socket
protected String grammarFileName
protected PrintWriter out
protected BufferedReader in
protected BaseRecognizer recognizer
protected TreeAdaptor adaptor
| Constructor Detail |
|---|
public DebugEventSocketProxy(BaseRecognizer recognizer,
TreeAdaptor adaptor)
public DebugEventSocketProxy(BaseRecognizer recognizer,
int port,
TreeAdaptor adaptor)
| Method Detail |
|---|
public void handshake()
throws IOException
IOExceptionpublic void commence()
DebugEventListener
commence in interface DebugEventListenercommence in class BlankDebugEventListenerpublic void terminate()
DebugEventListener
terminate in interface DebugEventListenerterminate in class BlankDebugEventListenerprotected void ack()
protected void transmit(String event)
public void enterRule(String grammarFileName,
String ruleName)
DebugEventListener
enterRule in interface DebugEventListenerenterRule in class BlankDebugEventListenerpublic void enterAlt(int alt)
DebugEventListener
enterAlt in interface DebugEventListenerenterAlt in class BlankDebugEventListener
public void exitRule(String grammarFileName,
String ruleName)
DebugEventListener
exitRule in interface DebugEventListenerexitRule in class BlankDebugEventListenerpublic void enterSubRule(int decisionNumber)
DebugEventListener
enterSubRule in interface DebugEventListenerenterSubRule in class BlankDebugEventListenerpublic void exitSubRule(int decisionNumber)
exitSubRule in interface DebugEventListenerexitSubRule in class BlankDebugEventListener
public void enterDecision(int decisionNumber,
boolean couldBacktrack)
DebugEventListener
enterDecision in interface DebugEventListenerenterDecision in class BlankDebugEventListenerpublic void exitDecision(int decisionNumber)
exitDecision in interface DebugEventListenerexitDecision in class BlankDebugEventListenerpublic void consumeToken(Token t)
DebugEventListener
consumeToken in interface DebugEventListenerconsumeToken in class BlankDebugEventListenerpublic void consumeHiddenToken(Token t)
DebugEventListener
consumeHiddenToken in interface DebugEventListenerconsumeHiddenToken in class BlankDebugEventListener
public void LT(int i,
Token t)
DebugEventListener
LT in interface DebugEventListenerLT in class BlankDebugEventListenerpublic void mark(int i)
DebugEventListener
mark in interface DebugEventListenermark in class BlankDebugEventListenerpublic void rewind(int i)
DebugEventListener
rewind in interface DebugEventListenerrewind in class BlankDebugEventListenerpublic void rewind()
DebugEventListener
rewind in interface DebugEventListenerrewind in class BlankDebugEventListenerpublic void beginBacktrack(int level)
beginBacktrack in interface DebugEventListenerbeginBacktrack in class BlankDebugEventListener
public void endBacktrack(int level,
boolean successful)
endBacktrack in interface DebugEventListenerendBacktrack in class BlankDebugEventListener
public void location(int line,
int pos)
DebugEventListener
location in interface DebugEventListenerlocation in class BlankDebugEventListenerpublic void recognitionException(RecognitionException e)
DebugEventListener
recognitionException in interface DebugEventListenerrecognitionException in class BlankDebugEventListenerpublic void beginResync()
DebugEventListener
beginResync in interface DebugEventListenerbeginResync in class BlankDebugEventListenerpublic void endResync()
DebugEventListener
endResync in interface DebugEventListenerendResync in class BlankDebugEventListener
public void semanticPredicate(boolean result,
String predicate)
DebugEventListener
semanticPredicate in interface DebugEventListenersemanticPredicate in class BlankDebugEventListenerpublic void consumeNode(Object t)
DebugEventListener
consumeNode in interface DebugEventListenerconsumeNode in class BlankDebugEventListener
public void LT(int i,
Object t)
DebugEventListener
LT in interface DebugEventListenerLT in class BlankDebugEventListener
protected void serializeNode(StringBuffer buf,
Object t)
public void nilNode(Object t)
DebugEventListener
nilNode in interface DebugEventListenernilNode in class BlankDebugEventListenerpublic void errorNode(Object t)
DebugEventListener
errorNode in interface DebugEventListenererrorNode in class BlankDebugEventListenerpublic void createNode(Object t)
DebugEventListener
createNode in interface DebugEventListenercreateNode in class BlankDebugEventListener
public void createNode(Object node,
Token token)
DebugEventListener
createNode in interface DebugEventListenercreateNode in class BlankDebugEventListener
public void becomeRoot(Object newRoot,
Object oldRoot)
DebugEventListener
becomeRoot in interface DebugEventListenerbecomeRoot in class BlankDebugEventListenerorg.antlr.runtime.tree.TreeAdaptor.becomeRoot()
public void addChild(Object root,
Object child)
DebugEventListener
addChild in interface DebugEventListeneraddChild in class BlankDebugEventListenerorg.antlr.runtime.tree.TreeAdaptor.addChild()
public void setTokenBoundaries(Object t,
int tokenStartIndex,
int tokenStopIndex)
DebugEventListener
setTokenBoundaries in interface DebugEventListenersetTokenBoundaries in class BlankDebugEventListenerpublic void setTreeAdaptor(TreeAdaptor adaptor)
public TreeAdaptor getTreeAdaptor()
protected String serializeToken(Token t)
protected void serializeText(StringBuffer buf,
String text)
protected String escapeNewlines(String txt)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||