From d07d2fca94d6fe043bd23501d4bd2115ff6b0ec9 Mon Sep 17 00:00:00 2001 From: Kevin Glynn Date: Sat, 17 Jul 2010 15:06:18 -0500 Subject: [PATCH] better debugging routines --- .../antlr3/src/cs2j/CSharp/CommonWalker.cs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/CSharpTranslator/antlr3/src/cs2j/CSharp/CommonWalker.cs b/CSharpTranslator/antlr3/src/cs2j/CSharp/CommonWalker.cs index 5382d6e..2fe4122 100644 --- a/CSharpTranslator/antlr3/src/cs2j/CSharp/CommonWalker.cs +++ b/CSharpTranslator/antlr3/src/cs2j/CSharp/CommonWalker.cs @@ -12,11 +12,35 @@ namespace RusticiSoftware.Translator.CSharp protected CommonWalker(ITreeNodeStream input, RecognizerSharedState state) : base(input, state) { } - + + + /// + /// Debug Routines + /// + private int debugLevel = 0; + + public int DebugLevel + { + get { return debugLevel; } + set { debugLevel = value; } + } protected void Debug(String s) { - Console.Out.WriteLine(s); + Debug(1, s); + } + + protected void DebugDetail(string s) + { + Debug(5, s); + } + + protected void Debug(int level, String s) + { + if (level <= DebugLevel) + { + Console.Out.WriteLine(s); + } } } }