001: package org.antlr.runtime.debug;
002:
003: import org.antlr.runtime.Token;
004: import org.antlr.runtime.RecognitionException;
005:
006: /** A simple event repeater (proxy) that delegates all functionality to the
007: * listener sent into the ctor. Useful if you want to listen in on a few
008: * debug events w/o interrupting the debugger. Just subclass the repeater
009: * and override the methods you want to listen in on. Remember to call
010: * the method in this class so the event will continue on to the original
011: * recipient.
012: *
013: * @see also DebugEventHub
014: */
015: public class DebugEventRepeater implements DebugEventListener {
016: protected DebugEventListener listener;
017:
018: public DebugEventRepeater(DebugEventListener listener) {
019: this .listener = listener;
020: }
021:
022: public void enterRule(String ruleName) {
023: listener.enterRule(ruleName);
024: }
025:
026: public void exitRule(String ruleName) {
027: listener.exitRule(ruleName);
028: }
029:
030: public void enterAlt(int alt) {
031: listener.enterAlt(alt);
032: }
033:
034: public void enterSubRule(int decisionNumber) {
035: listener.enterSubRule(decisionNumber);
036: }
037:
038: public void exitSubRule(int decisionNumber) {
039: listener.exitSubRule(decisionNumber);
040: }
041:
042: public void enterDecision(int decisionNumber) {
043: listener.enterDecision(decisionNumber);
044: }
045:
046: public void exitDecision(int decisionNumber) {
047: listener.exitDecision(decisionNumber);
048: }
049:
050: public void location(int line, int pos) {
051: listener.location(line, pos);
052: }
053:
054: public void consumeToken(Token token) {
055: listener.consumeToken(token);
056: }
057:
058: public void consumeHiddenToken(Token token) {
059: listener.consumeHiddenToken(token);
060: }
061:
062: public void LT(int i, Token t) {
063: listener.LT(i, t);
064: }
065:
066: public void mark(int i) {
067: listener.mark(i);
068: }
069:
070: public void rewind(int i) {
071: listener.rewind(i);
072: }
073:
074: public void rewind() {
075: listener.rewind();
076: }
077:
078: public void beginBacktrack(int level) {
079: listener.beginBacktrack(level);
080: }
081:
082: public void endBacktrack(int level, boolean successful) {
083: listener.endBacktrack(level, successful);
084: }
085:
086: public void recognitionException(RecognitionException e) {
087: listener.recognitionException(e);
088: }
089:
090: public void beginResync() {
091: listener.beginResync();
092: }
093:
094: public void endResync() {
095: listener.endResync();
096: }
097:
098: public void semanticPredicate(boolean result, String predicate) {
099: listener.semanticPredicate(result, predicate);
100: }
101:
102: public void commence() {
103: listener.commence();
104: }
105:
106: public void terminate() {
107: listener.terminate();
108: }
109:
110: // Tree parsing stuff
111:
112: public void consumeNode(Object t) {
113: listener.consumeNode(t);
114: }
115:
116: public void LT(int i, Object t) {
117: listener.LT(i, t);
118: }
119:
120: // AST Stuff
121:
122: public void nilNode(Object t) {
123: listener.nilNode(t);
124: }
125:
126: public void createNode(Object t) {
127: listener.createNode(t);
128: }
129:
130: public void createNode(Object node, Token token) {
131: listener.createNode(node, token);
132: }
133:
134: public void becomeRoot(Object newRoot, Object oldRoot) {
135: listener.becomeRoot(newRoot, oldRoot);
136: }
137:
138: public void addChild(Object root, Object child) {
139: listener.addChild(root, child);
140: }
141:
142: public void setTokenBoundaries(Object t, int tokenStartIndex,
143: int tokenStopIndex) {
144: listener.setTokenBoundaries(t, tokenStartIndex, tokenStopIndex);
145: }
146: }
|