001
002 package com.javadoq.javadoc;
003
004 public class JavadocParserimplements JavadocParserTreeConstants, JavadocParserConstants {
005 protected JJTJavadocParserState jjtree = new JJTJavadocParserState();
006 void jjtreeOpenNodeScope(Node n) {
007 ((ASTNode)n).firstToken = getToken(1);
008 }
009
010 void jjtreeCloseNodeScope(Node n) {
011 ((ASTNode)n).lastToken = getToken(0);
012 }
013
014 final public ASTCompilationUnit CompilationUnit() throws ParseException {
015
016 ASTCompilationUnit jjtn000 = new ASTCompilationUnit(this, JJTCOMPILATIONUNIT);
017 boolean jjtc000 = true;
018 jjtree.openNodeScope(jjtn000);
019 jjtreeOpenNodeScope(jjtn000);
020 try {
021 label_1:
022 while (true) {
023 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
024 case LINK_START:
025 case SEE_START:
026 case ANCHOR_START:
027 case SPACE:
028 case COMMENT:
029 ;
030 break;
031 default:
032 jj_la1[0] = jj_gen;
033 break label_1;
034 }
035 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
036 case LINK_START:
037 Link();
038 break;
039 case SEE_START:
040 See();
041 break;
042 case ANCHOR_START:
043 Anchor();
044 break;
045 case SPACE:
046 jj_consume_token(SPACE);
047 break;
048 case COMMENT:
049 jj_consume_token(COMMENT);
050 break;
051 default:
052 jj_la1[1] = jj_gen;
053 jj_consume_token(-1);
054 throw new ParseException();
055 }
056 }
057 jj_consume_token(0);
058 jjtree.closeNodeScope(jjtn000, true);
059 jjtc000 = false;
060 jjtreeCloseNodeScope(jjtn000);
061 {if (true) return jjtn000;}
062 } catch (Throwable jjte000) {
063 if (jjtc000) {
064 jjtree.clearNodeScope(jjtn000);
065 jjtc000 = false;
066 } else {
067 jjtree.popNode();
068 }
069 if (jjte000 instanceof RuntimeException) {
070 {if (true) throw (RuntimeException)jjte000;}
071 }
072 if (jjte000 instanceof ParseException) {
073 {if (true) throw (ParseException)jjte000;}
074 }
075 {if (true) throw (Error)jjte000;}
076 } finally {
077 if (jjtc000) {
078 jjtree.closeNodeScope(jjtn000, true);
079 jjtreeCloseNodeScope(jjtn000);
080 }
081 }
082 throw new Error("Missing return statement in function");
083 }
084
085 final public void Link() throws ParseException {
086 jj_consume_token(LINK_START);
087 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
088 case LINK:
089 jj_consume_token(LINK);
090 break;
091 default:
092 jj_la1[2] = jj_gen;
093 ;
094 }
095 jj_consume_token(LINK_CLOSE);
096 }
097
098 final public void See() throws ParseException {
099 jj_consume_token(SEE_START);
100 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
101 case SEE:
102 jj_consume_token(SEE);
103 break;
104 default:
105 jj_la1[3] = jj_gen;
106 ;
107 }
108 jj_consume_token(SEE_CLOSE);
109 }
110
111 final public void Anchor() throws ParseException {
112 jj_consume_token(ANCHOR_START);
113 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
114 case ANCHOR:
115 jj_consume_token(ANCHOR);
116 break;
117 default:
118 jj_la1[4] = jj_gen;
119 ;
120 }
121 jj_consume_token(ANCHOR_CLOSE);
122 }
123
124
125 public JavadocParserTokenManager token_source;
126 JavaCharStream jj_input_stream;
127
128 public Token token;
129
130 public Token jj_nt;
131 private int jj_ntk;
132 private int jj_gen;
133 final private int[] jj_la1 = new int[5];
134 static private int[] jj_la1_0;
135 static {
136 jj_la1_init_0();
137 }
138 private static void jj_la1_init_0() {
139 jj_la1_0 = new int[] {0x5e,0x5e,0x80,0x200,0x800,};
140 }
141
142
143 public JavadocParser(java.io.InputStream stream) {
144 this(stream, null);
145 }
146
147 public JavadocParser(java.io.InputStream stream, String encoding) {
148 try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
149 token_source = new JavadocParserTokenManager(jj_input_stream);
150 token = new Token();
151 jj_ntk = -1;
152 jj_gen = 0;
153 for (int i = 0; i < 5; i++) jj_la1[i] = -1;
154 }
155
156
157 public void ReInit(java.io.InputStream stream) {
158 ReInit(stream, null);
159 }
160
161 public void ReInit(java.io.InputStream stream, String encoding) {
162 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
163 token_source.ReInit(jj_input_stream);
164 token = new Token();
165 jj_ntk = -1;
166 jjtree.reset();
167 jj_gen = 0;
168 for (int i = 0; i < 5; i++) jj_la1[i] = -1;
169 }
170
171
172 public JavadocParser(java.io.Reader stream) {
173 jj_input_stream = new JavaCharStream(stream, 1, 1);
174 token_source = new JavadocParserTokenManager(jj_input_stream);
175 token = new Token();
176 jj_ntk = -1;
177 jj_gen = 0;
178 for (int i = 0; i < 5; i++) jj_la1[i] = -1;
179 }
180
181
182 public void ReInit(java.io.Reader stream) {
183 jj_input_stream.ReInit(stream, 1, 1);
184 token_source.ReInit(jj_input_stream);
185 token = new Token();
186 jj_ntk = -1;
187 jjtree.reset();
188 jj_gen = 0;
189 for (int i = 0; i < 5; i++) jj_la1[i] = -1;
190 }
191
192
193 public JavadocParser(JavadocParserTokenManager tm) {
194 token_source = tm;
195 token = new Token();
196 jj_ntk = -1;
197 jj_gen = 0;
198 for (int i = 0; i < 5; i++) jj_la1[i] = -1;
199 }
200
201
202 public void ReInit(JavadocParserTokenManager tm) {
203 token_source = tm;
204 token = new Token();
205 jj_ntk = -1;
206 jjtree.reset();
207 jj_gen = 0;
208 for (int i = 0; i < 5; i++) jj_la1[i] = -1;
209 }
210
211 private Token jj_consume_token(int kind) throws ParseException {
212 Token oldToken;
213 if ((oldToken = token).next != null) token = token.next;
214 else token = token.next = token_source.getNextToken();
215 jj_ntk = -1;
216 if (token.kind == kind) {
217 jj_gen++;
218 return token;
219 }
220 token = oldToken;
221 jj_kind = kind;
222 throw generateParseException();
223 }
224
225
226
227 final public Token getNextToken() {
228 if (token.next != null) token = token.next;
229 else token = token.next = token_source.getNextToken();
230 jj_ntk = -1;
231 jj_gen++;
232 return token;
233 }
234
235
236 final public Token getToken(int index) {
237 Token t = token;
238 for (int i = 0; i < index; i++) {
239 if (t.next != null) t = t.next;
240 else t = t.next = token_source.getNextToken();
241 }
242 return t;
243 }
244
245 private int jj_ntk() {
246 if ((jj_nt=token.next) == null)
247 return (jj_ntk = (token.next=token_source.getNextToken()).kind);
248 else
249 return (jj_ntk = jj_nt.kind);
250 }
251
252 private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
253 private int[] jj_expentry;
254 private int jj_kind = -1;
255
256
257 public ParseException generateParseException() {
258 jj_expentries.clear();
259 boolean[] la1tokens = new boolean[13];
260 if (jj_kind >= 0) {
261 la1tokens[jj_kind] = true;
262 jj_kind = -1;
263 }
264 for (int i = 0; i < 5; i++) {
265 if (jj_la1[i] == jj_gen) {
266 for (int j = 0; j < 32; j++) {
267 if ((jj_la1_0[i] & (1<<j)) != 0) {
268 la1tokens[j] = true;
269 }
270 }
271 }
272 }
273 for (int i = 0; i < 13; i++) {
274 if (la1tokens[i]) {
275 jj_expentry = new int[1];
276 jj_expentry[0] = i;
277 jj_expentries.add(jj_expentry);
278 }
279 }
280 int[][] exptokseq = new int[jj_expentries.size()][];
281 for (int i = 0; i < jj_expentries.size(); i++) {
282 exptokseq[i] = jj_expentries.get(i);
283 }
284 return new ParseException(token, exptokseq, tokenImage);
285 }
286
287
288 final public void enable_tracing() {
289 }
290
291
292 final public void disable_tracing() {
293 }
294
295 }