• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * [The "BSD licence"]
3  * Copyright (c) 2005-2008 Terence Parr
4  * All rights reserved.
5  *
6  * Conversion to C#:
7  * Copyright (c) 2008-2009 Sam Harwell, Pixel Mine, Inc.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 namespace Antlr.Runtime.Debug {
34 
35     /** <summary>
36      *  A simple event repeater (proxy) that delegates all functionality to the
37      *  listener sent into the ctor.  Useful if you want to listen in on a few
38      *  debug events w/o interrupting the debugger.  Just subclass the repeater
39      *  and override the methods you want to listen in on.  Remember to call
40      *  the method in this class so the event will continue on to the original
41      *  recipient.
42      *  </summary>
43      *
44      *  <seealso cref="DebugEventHub"/>
45      */
46     public class DebugEventRepeater : IDebugEventListener {
47         IDebugEventListener _listener;
48 
DebugEventRepeater(IDebugEventListener listener)49         public DebugEventRepeater(IDebugEventListener listener) {
50             _listener = listener;
51         }
52 
Initialize()53         public virtual void Initialize() {
54         }
55 
EnterRule(string grammarFileName, string ruleName)56         public virtual void EnterRule(string grammarFileName, string ruleName) {
57             _listener.EnterRule(grammarFileName, ruleName);
58         }
ExitRule(string grammarFileName, string ruleName)59         public virtual void ExitRule(string grammarFileName, string ruleName) {
60             _listener.ExitRule(grammarFileName, ruleName);
61         }
EnterAlt(int alt)62         public virtual void EnterAlt(int alt) {
63             _listener.EnterAlt(alt);
64         }
EnterSubRule(int decisionNumber)65         public virtual void EnterSubRule(int decisionNumber) {
66             _listener.EnterSubRule(decisionNumber);
67         }
ExitSubRule(int decisionNumber)68         public virtual void ExitSubRule(int decisionNumber) {
69             _listener.ExitSubRule(decisionNumber);
70         }
EnterDecision(int decisionNumber, bool couldBacktrack)71         public virtual void EnterDecision(int decisionNumber, bool couldBacktrack) {
72             _listener.EnterDecision(decisionNumber, couldBacktrack);
73         }
ExitDecision(int decisionNumber)74         public virtual void ExitDecision(int decisionNumber) {
75             _listener.ExitDecision(decisionNumber);
76         }
Location(int line, int pos)77         public virtual void Location(int line, int pos) {
78             _listener.Location(line, pos);
79         }
ConsumeToken(IToken token)80         public virtual void ConsumeToken(IToken token) {
81             _listener.ConsumeToken(token);
82         }
ConsumeHiddenToken(IToken token)83         public virtual void ConsumeHiddenToken(IToken token) {
84             _listener.ConsumeHiddenToken(token);
85         }
LT(int i, IToken t)86         public virtual void LT(int i, IToken t) {
87             _listener.LT(i, t);
88         }
Mark(int i)89         public virtual void Mark(int i) {
90             _listener.Mark(i);
91         }
Rewind(int i)92         public virtual void Rewind(int i) {
93             _listener.Rewind(i);
94         }
Rewind()95         public virtual void Rewind() {
96             _listener.Rewind();
97         }
BeginBacktrack(int level)98         public virtual void BeginBacktrack(int level) {
99             _listener.BeginBacktrack(level);
100         }
EndBacktrack(int level, bool successful)101         public virtual void EndBacktrack(int level, bool successful) {
102             _listener.EndBacktrack(level, successful);
103         }
RecognitionException(RecognitionException e)104         public virtual void RecognitionException(RecognitionException e) {
105             _listener.RecognitionException(e);
106         }
BeginResync()107         public virtual void BeginResync() {
108             _listener.BeginResync();
109         }
EndResync()110         public virtual void EndResync() {
111             _listener.EndResync();
112         }
SemanticPredicate(bool result, string predicate)113         public virtual void SemanticPredicate(bool result, string predicate) {
114             _listener.SemanticPredicate(result, predicate);
115         }
Commence()116         public virtual void Commence() {
117             _listener.Commence();
118         }
Terminate()119         public virtual void Terminate() {
120             _listener.Terminate();
121         }
122 
123         #region Tree parsing stuff
124 
ConsumeNode(object t)125         public virtual void ConsumeNode(object t) {
126             _listener.ConsumeNode(t);
127         }
LT(int i, object t)128         public virtual void LT(int i, object t) {
129             _listener.LT(i, t);
130         }
131 
132         #endregion
133 
134 
135         #region AST Stuff
136 
NilNode(object t)137         public virtual void NilNode(object t) {
138             _listener.NilNode(t);
139         }
ErrorNode(object t)140         public virtual void ErrorNode(object t) {
141             _listener.ErrorNode(t);
142         }
CreateNode(object t)143         public virtual void CreateNode(object t) {
144             _listener.CreateNode(t);
145         }
CreateNode(object node, IToken token)146         public virtual void CreateNode(object node, IToken token) {
147             _listener.CreateNode(node, token);
148         }
BecomeRoot(object newRoot, object oldRoot)149         public virtual void BecomeRoot(object newRoot, object oldRoot) {
150             _listener.BecomeRoot(newRoot, oldRoot);
151         }
AddChild(object root, object child)152         public virtual void AddChild(object root, object child) {
153             _listener.AddChild(root, child);
154         }
SetTokenBoundaries(object t, int tokenStartIndex, int tokenStopIndex)155         public virtual void SetTokenBoundaries(object t, int tokenStartIndex, int tokenStopIndex) {
156             _listener.SetTokenBoundaries(t, tokenStartIndex, tokenStopIndex);
157         }
158 
159         #endregion
160     }
161 }
162