KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aop > annotation > ast > AnnotationParserTester


1 package org.jboss.aop.annotation.ast;
2
3
4
5 public class AnnotationParserTester implements AnnotationParserVisitor
6 {
7    private int indent = 0;
8
9    private String JavaDoc indentString()
10    {
11       StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
12       for (int i = 0; i < indent; ++i)
13       {
14          sb.append(" ");
15       }
16       return sb.toString();
17    }
18
19    public Object JavaDoc visit(ASTSingleMemberValue node, Object JavaDoc data)
20    {
21       System.out.println(indentString() + node);
22       ++indent;
23       data = node.childrenAccept(this, data);
24       --indent;
25       return data;
26    }
27
28    public Object JavaDoc visit(SimpleNode node, Object JavaDoc data)
29    {
30       System.out.println(indentString() + node +
31               ": acceptor not unimplemented in subclass?");
32       ++indent;
33       data = node.childrenAccept(this, data);
34       --indent;
35       return data;
36    }
37
38    public Object JavaDoc visit(ASTStart node, Object JavaDoc data)
39    {
40       System.out.println(indentString() + node);
41       ++indent;
42       data = node.childrenAccept(this, data);
43       --indent;
44       return data;
45    }
46
47    public Object JavaDoc visit(ASTAnnotation node, Object JavaDoc data)
48    {
49       System.out.println(indentString() + node);
50       ++indent;
51       data = node.childrenAccept(this, data);
52       --indent;
53       return data;
54    }
55
56    public Object JavaDoc visit(ASTMemberValuePairs node, Object JavaDoc data)
57    {
58       System.out.println(indentString() + node);
59       ++indent;
60       data = node.childrenAccept(this, data);
61       --indent;
62       return data;
63    }
64
65    public Object JavaDoc visit(ASTMemberValuePair node, Object JavaDoc data)
66    {
67       System.out.println(indentString() + node);
68       ++indent;
69       data = node.childrenAccept(this, data);
70       --indent;
71       return data;
72    }
73
74    public Object JavaDoc visit(ASTMemberValueArrayInitializer node, Object JavaDoc data)
75    {
76       System.out.println(indentString() + node);
77       ++indent;
78       data = node.childrenAccept(this, data);
79       --indent;
80       return data;
81    }
82
83    public Object JavaDoc visit(ASTIdentifier node, Object JavaDoc data)
84    {
85       System.out.println(indentString() + node);
86       ++indent;
87       data = node.childrenAccept(this, data);
88       --indent;
89       return data;
90    }
91
92    public Object JavaDoc visit(ASTString node, Object JavaDoc data)
93    {
94       System.out.println(indentString() + node);
95       ++indent;
96       data = node.childrenAccept(this, data);
97       --indent;
98       return data;
99    }
100
101    public Object JavaDoc visit(ASTChar node, Object JavaDoc data)
102    {
103       System.out.println(indentString() + node);
104       ++indent;
105       data = node.childrenAccept(this, data);
106       --indent;
107       return data;
108    }
109
110    public static void main(String JavaDoc args[])
111    {
112 // System.out.println("----" + args[0]);
113
// StringReader reader = new StringReader(args[0]);
114
System.out.println("Reading from stdin");
115       AnnotationParser t = new AnnotationParser(System.in);
116       //PointcutExpressionParser t = new PointcutExpressionParser(System.in);
117
try
118       {
119          ASTStart n = t.Start();
120          AnnotationParserVisitor v = new AnnotationParserTester();
121          n.jjtAccept(v, null);
122       }
123       catch (Exception JavaDoc e)
124       {
125          System.out.println("Oops.");
126          System.out.println(e.getMessage());
127          e.printStackTrace();
128       }
129    }
130 }
131
132 /*end*/
133
Popular Tags