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