• 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     /** <summary>
35      *  A blank listener that does nothing; useful for real classes so
36      *  they don't have to have lots of blank methods and are less
37      *  sensitive to updates to debug interface.
38      *  </summary>
39      */
40     public class BlankDebugEventListener : IDebugEventListener {
41         public int RuleLevel {
42             get;
43             protected set;
44         }
45 
Initialize()46         public virtual void Initialize() {
47         }
48 
EnterRule(string grammarFileName, string ruleName)49         public virtual void EnterRule(string grammarFileName, string ruleName) {
50             if (RuleLevel == 0)
51                 Commence();
52             RuleLevel++;
53         }
ExitRule(string grammarFileName, string ruleName)54         public virtual void ExitRule(string grammarFileName, string ruleName) {
55             RuleLevel--;
56             if (RuleLevel == 0)
57                 Terminate();
58         }
EnterAlt(int alt)59         public virtual void EnterAlt(int alt) {
60         }
EnterSubRule(int decisionNumber)61         public virtual void EnterSubRule(int decisionNumber) {
62         }
ExitSubRule(int decisionNumber)63         public virtual void ExitSubRule(int decisionNumber) {
64         }
EnterDecision(int decisionNumber, bool couldBacktrack)65         public virtual void EnterDecision(int decisionNumber, bool couldBacktrack) {
66         }
ExitDecision(int decisionNumber)67         public virtual void ExitDecision(int decisionNumber) {
68         }
Location(int line, int pos)69         public virtual void Location(int line, int pos) {
70         }
ConsumeToken(IToken token)71         public virtual void ConsumeToken(IToken token) {
72         }
ConsumeHiddenToken(IToken token)73         public virtual void ConsumeHiddenToken(IToken token) {
74         }
LT(int i, IToken t)75         public virtual void LT(int i, IToken t) {
76         }
Mark(int i)77         public virtual void Mark(int i) {
78         }
Rewind(int i)79         public virtual void Rewind(int i) {
80         }
Rewind()81         public virtual void Rewind() {
82         }
BeginBacktrack(int level)83         public virtual void BeginBacktrack(int level) {
84         }
EndBacktrack(int level, bool successful)85         public virtual void EndBacktrack(int level, bool successful) {
86         }
RecognitionException(RecognitionException e)87         public virtual void RecognitionException(RecognitionException e) {
88         }
BeginResync()89         public virtual void BeginResync() {
90         }
EndResync()91         public virtual void EndResync() {
92         }
SemanticPredicate(bool result, string predicate)93         public virtual void SemanticPredicate(bool result, string predicate) {
94         }
Commence()95         public virtual void Commence() {
96         }
Terminate()97         public virtual void Terminate() {
98         }
99 
100         #region Tree parsing stuff
101 
ConsumeNode(object t)102         public virtual void ConsumeNode(object t) {
103         }
LT(int i, object t)104         public virtual void LT(int i, object t) {
105         }
106 
107         #endregion
108 
109 
110         #region AST Stuff
111 
NilNode(object t)112         public virtual void NilNode(object t) {
113         }
ErrorNode(object t)114         public virtual void ErrorNode(object t) {
115         }
CreateNode(object t)116         public virtual void CreateNode(object t) {
117         }
CreateNode(object node, IToken token)118         public virtual void CreateNode(object node, IToken token) {
119         }
BecomeRoot(object newRoot, object oldRoot)120         public virtual void BecomeRoot(object newRoot, object oldRoot) {
121         }
AddChild(object root, object child)122         public virtual void AddChild(object root, object child) {
123         }
SetTokenBoundaries(object t, int tokenStartIndex, int tokenStopIndex)124         public virtual void SetTokenBoundaries(object t, int tokenStartIndex, int tokenStopIndex) {
125         }
126 
127         #endregion
128     }
129 }
130 
131