KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > debug > Tracer


1 package persistence.antlr.debug;
2
3 public class Tracer extends TraceAdapter implements TraceListener {
4     String JavaDoc indent=""; // TBD: should be StringBuffer
5

6
7     protected void dedent() {
8         if (indent.length() < 2)
9             indent = "";
10         else
11             indent = indent.substring(2);
12     }
13     public void enterRule(TraceEvent e) {
14         System.out.println(indent+e);
15         indent();
16     }
17     public void exitRule(TraceEvent e) {
18         dedent();
19         System.out.println(indent+e);
20     }
21     protected void indent() {
22         indent += " ";
23     }
24 }
25
Popular Tags