1 | /*@bgen(jjtree) Generated By:JJTree: Do not edit this line. FramclipseNonScriptParser.jj */
|
---|
2 | /*@egen*/options {
|
---|
3 | JDK_VERSION = "1.5";
|
---|
4 | USER_CHAR_STREAM = true;
|
---|
5 | STATIC = false;
|
---|
6 |
|
---|
7 | }
|
---|
8 |
|
---|
9 | PARSER_BEGIN(FramclipseNonScriptParser)
|
---|
10 |
|
---|
11 | package com.framsticks.framclipse.internal.parser;
|
---|
12 |
|
---|
13 | import java.io.StringReader;
|
---|
14 |
|
---|
15 | public class FramclipseNonScriptParser/*@bgen(jjtree)*/implements FramclipseNonScriptParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
|
---|
16 | protected JJTFramclipseNonScriptParserState jjtree = new JJTFramclipseNonScriptParserState();
|
---|
17 |
|
---|
18 | /*@egen*/
|
---|
19 |
|
---|
20 | private CharStreamWithOffset charStream = null;
|
---|
21 |
|
---|
22 | public java.util.Collection<Exception> exceptions = new java.util.ArrayList<Exception>();
|
---|
23 |
|
---|
24 | public FramclipseNonScriptParser(String input)
|
---|
25 | {
|
---|
26 | this(new CharStreamWithOffset(new StringReader(input)));
|
---|
27 | }
|
---|
28 |
|
---|
29 | private FramclipseNonScriptParser(CharStreamWithOffset charStream)
|
---|
30 | {
|
---|
31 | this((CharStream)charStream);
|
---|
32 | this.charStream = charStream;
|
---|
33 | }
|
---|
34 |
|
---|
35 | public static void main(String args[]) {
|
---|
36 | String s = "expdef: \n name: urnohorl \n id: horla \n code:~ function kupa(a,b) { yeah \n } \n~\n\n\n";
|
---|
37 |
|
---|
38 | FramclipseNonScriptParser t = new FramclipseNonScriptParser(s);
|
---|
39 | try {
|
---|
40 | SimpleNode n = t.FramclipseFile();
|
---|
41 | n.dump("");
|
---|
42 | System.out.println("Thank you.");
|
---|
43 | } catch (Exception e) {
|
---|
44 | System.out.println("Oops.");
|
---|
45 | System.out.println(e.getMessage());
|
---|
46 | //e.printStackTrace();
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
50 |
|
---|
51 | PARSER_END(FramclipseNonScriptParser)
|
---|
52 |
|
---|
53 | TOKEN_MGR_DECLS : {
|
---|
54 |
|
---|
55 | int blockNestingDepth ;
|
---|
56 |
|
---|
57 | }
|
---|
58 |
|
---|
59 | <CodeSection, Block> SKIP :
|
---|
60 | {
|
---|
61 | < "/*"(~["*"])* "*"(~["/"] (~["*"])* "*")* "/" >
|
---|
62 | | <"//"(~["\r","\n"])*["\r"]"\n">
|
---|
63 | }
|
---|
64 |
|
---|
65 | <CodeSection, GlobalInclude> SKIP : /* WHITE SPACE */
|
---|
66 | {
|
---|
67 | " "
|
---|
68 | | "\t"
|
---|
69 | | "\r"
|
---|
70 | | "\n"
|
---|
71 | | "\f"
|
---|
72 | }
|
---|
73 |
|
---|
74 | <DEFAULT,SingleSect, MultiSect> SKIP : /* WHITE SPACE */
|
---|
75 | {
|
---|
76 | " "
|
---|
77 | | "\t"
|
---|
78 | }
|
---|
79 |
|
---|
80 | <DEFAULT> TOKEN : /* IDENTIFIERS */
|
---|
81 | {
|
---|
82 | < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
|
---|
83 | |
|
---|
84 | < #LETTER: ["_","a"-"z","A"-"Z"] >
|
---|
85 | |
|
---|
86 | < #DIGIT: ["0"-"9"] >
|
---|
87 | }
|
---|
88 |
|
---|
89 | <DEFAULT> TOKEN :
|
---|
90 | {
|
---|
91 | < EOL: ("\r")?"\n" >
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | <DEFAULT> TOKEN : { <CODE_SECTION_START : "code:~" > : CodeSection }
|
---|
97 |
|
---|
98 | <DEFAULT> TOKEN : { < MULTI_SECT_START : ":~" > : MultiSect }
|
---|
99 |
|
---|
100 | <DEFAULT> TOKEN : { <SINGLE_SECT_START : ":" > : SingleSect }
|
---|
101 |
|
---|
102 | <DEFAULT> TOKEN : { <GLOBAL_INCLUDE_KWD : "#include" > : GlobalInclude }
|
---|
103 |
|
---|
104 | <DEFAULT> SKIP :
|
---|
105 | {
|
---|
106 | <"# "(~["\r","\n"])*["\r"]"\n">
|
---|
107 | }
|
---|
108 |
|
---|
109 |
|
---|
110 | <GlobalInclude> TOKEN :
|
---|
111 | {
|
---|
112 | < INCLUDE_STRING:
|
---|
113 | "\""
|
---|
114 | ( (~["\"","\\","\n","\r"])
|
---|
115 | | ("\\"
|
---|
116 | ( ["n","t","b","r","f","\\","'","\"","_"]
|
---|
117 | | ["0"-"7"] ( ["0"-"7"] )?
|
---|
118 | | ["0"-"3"] ["0"-"7"] ["0"-"7"]
|
---|
119 | )
|
---|
120 | )
|
---|
121 | )*
|
---|
122 | "\""
|
---|
123 | > : DEFAULT
|
---|
124 | }
|
---|
125 |
|
---|
126 | <MultiSect> TOKEN : { <
|
---|
127 | MULTI_SECT_END : "~" (" ")* ("\r")?"\n" > : DEFAULT }
|
---|
128 |
|
---|
129 | <MultiSect> TOKEN :
|
---|
130 | {
|
---|
131 | <MULTILINE_PROP_VALUE : (~["~"] | "\\~")* >
|
---|
132 | }
|
---|
133 |
|
---|
134 | <CodeSection> TOKEN :
|
---|
135 | {
|
---|
136 | < STRING_LITERAL:
|
---|
137 | "\""
|
---|
138 | ( (~["\"","\\","\n","\r"])
|
---|
139 | | ("\\"
|
---|
140 | ( ["n","t","b","r","f","\\","'","\"","_"]
|
---|
141 | | ["0"-"7"] ( ["0"-"7"] )?
|
---|
142 | | ["0"-"3"] ["0"-"7"] ["0"-"7"]
|
---|
143 | )
|
---|
144 | )
|
---|
145 | )*
|
---|
146 | "\""
|
---|
147 | >
|
---|
148 | |
|
---|
149 | < UNTERM_STRING_LITERAL:
|
---|
150 | "\""
|
---|
151 | ( (~["\"","\\","\n","\r"])
|
---|
152 | | ("\\"
|
---|
153 | ( ["n","t","b","r","f","\\","'","\"","_"]
|
---|
154 | | ["0"-"7"] ( ["0"-"7"] )?
|
---|
155 | | ["0"-"3"] ["0"-"7"] ["0"-"7"]
|
---|
156 | )
|
---|
157 | )
|
---|
158 | )* ["\r"] "\n"
|
---|
159 | >
|
---|
160 |
|
---|
161 | }
|
---|
162 |
|
---|
163 | <CodeSection> TOKEN : { < CODE_SECTION_END : "~" (" ")* ("\r")?"\n" > : DEFAULT }
|
---|
164 |
|
---|
165 | <CodeSection> TOKEN :
|
---|
166 | {
|
---|
167 | <GLOBAL_KWD : "global" >
|
---|
168 | |
|
---|
169 | <FUNCTION_KWD : "function" >
|
---|
170 | |
|
---|
171 | <INCLUDE_KWD : "@include" >
|
---|
172 |
|
---|
173 | /*
|
---|
174 | |
|
---|
175 | <FOR_KWD : "for" >
|
---|
176 | |
|
---|
177 | <WHILE_KWD : "while" >
|
---|
178 | |
|
---|
179 | <VAR_KWD : "VAR" >
|
---|
180 | |
|
---|
181 | <TYPEOF_KWD : "typeof" >
|
---|
182 | |
|
---|
183 | <DO_KWD : "do" >
|
---|
184 | |
|
---|
185 | <BREAK_KWD : "break" >
|
---|
186 | |
|
---|
187 | <SWITCH_KWD : "switch" >
|
---|
188 | |
|
---|
189 | <CASE_KWD : "case" >
|
---|
190 | |
|
---|
191 | <GOTO_KWD : "goto" >
|
---|
192 | |
|
---|
193 | <DEFAULT_KWD : "default" >
|
---|
194 | |
|
---|
195 | <RETURN_KWD : "return" >
|
---|
196 | |
|
---|
197 | <ASM_KWD : "asm" >
|
---|
198 | */
|
---|
199 | }
|
---|
200 |
|
---|
201 | <CodeSection> TOKEN : /* SEPARATORS */
|
---|
202 | {
|
---|
203 | < LPAREN: "(" >
|
---|
204 | | < RPAREN: ")" >
|
---|
205 | | < LBRACE : "{" > { blockNestingDepth = 1 ; } : Block
|
---|
206 | | "}"
|
---|
207 | | < LBRACKET: "[" >
|
---|
208 | | < RBRACKET: "]" >
|
---|
209 | | < SEMICOLON: ";" >
|
---|
210 | | < COMMA: "," >
|
---|
211 | | < DOT: "." >
|
---|
212 | }
|
---|
213 |
|
---|
214 | <CodeSection> TOKEN : /* IDENTIFIERS */
|
---|
215 | {
|
---|
216 | < IDENT: <LETTER> (<LETTER>|<DIGIT>)* >
|
---|
217 | }
|
---|
218 |
|
---|
219 | <Block> TOKEN :
|
---|
220 | {
|
---|
221 | < NESTED_LBRACE : "{" > { blockNestingDepth += 1 ; }
|
---|
222 | |
|
---|
223 | < RBRACE : "}" > {
|
---|
224 | blockNestingDepth --;
|
---|
225 | SwitchTo( blockNestingDepth==0 ? CodeSection : Block ) ;
|
---|
226 | }
|
---|
227 | }
|
---|
228 |
|
---|
229 | <Block> SKIP :
|
---|
230 | {
|
---|
231 | <~[]>
|
---|
232 | }
|
---|
233 |
|
---|
234 | <SingleSect> TOKEN :
|
---|
235 | {
|
---|
236 | < SINGLE_SECT_END : ("\r")?"\n" > : DEFAULT
|
---|
237 | }
|
---|
238 |
|
---|
239 | <SingleSect> TOKEN :
|
---|
240 | {
|
---|
241 | < PROP_VALUE : (~["\r","\n"])* >
|
---|
242 | }
|
---|
243 |
|
---|
244 | ASTFramclipseFile FramclipseFile() : {/*@bgen(jjtree) FramclipseFile */
|
---|
245 | ASTFramclipseFile jjtn000 = new ASTFramclipseFile(JJTFRAMCLIPSEFILE);
|
---|
246 | boolean jjtc000 = true;
|
---|
247 | jjtree.openNodeScope(jjtn000);
|
---|
248 | /*@egen*/}
|
---|
249 | {/*@bgen(jjtree) FramclipseFile */
|
---|
250 | try {
|
---|
251 | /*@egen*/
|
---|
252 | /* FObject() (LOOKAHEAD ((<EOL>)+ FObject()) (<EOL>)+ FObject())* (<EOL>)* */
|
---|
253 | (((FObject()|GlobalInclude()) (<EOL>|<EOF>))|<EOL>)*/*@bgen(jjtree)*/
|
---|
254 | {
|
---|
255 | jjtree.closeNodeScope(jjtn000, true);
|
---|
256 | jjtc000 = false;
|
---|
257 | }
|
---|
258 | /*@egen*/
|
---|
259 |
|
---|
260 | { return jjtn000; }/*@bgen(jjtree)*/
|
---|
261 | } catch (Throwable jjte000) {
|
---|
262 | if (jjtc000) {
|
---|
263 | jjtree.clearNodeScope(jjtn000);
|
---|
264 | jjtc000 = false;
|
---|
265 | } else {
|
---|
266 | jjtree.popNode();
|
---|
267 | }
|
---|
268 | if (jjte000 instanceof RuntimeException) {
|
---|
269 | throw (RuntimeException)jjte000;
|
---|
270 | }
|
---|
271 | if (jjte000 instanceof ParseException) {
|
---|
272 | throw (ParseException)jjte000;
|
---|
273 | }
|
---|
274 | throw (Error)jjte000;
|
---|
275 | } finally {
|
---|
276 | if (jjtc000) {
|
---|
277 | jjtree.closeNodeScope(jjtn000, true);
|
---|
278 | }
|
---|
279 | }
|
---|
280 | /*@egen*/
|
---|
281 | }
|
---|
282 |
|
---|
283 | void FObject() : {/*@bgen(jjtree) FObject */
|
---|
284 | ASTFObject jjtn000 = new ASTFObject(JJTFOBJECT);
|
---|
285 | boolean jjtc000 = true;
|
---|
286 | jjtree.openNodeScope(jjtn000);
|
---|
287 | /*@egen*/ }
|
---|
288 | {/*@bgen(jjtree) FObject */
|
---|
289 | try {
|
---|
290 | /*@egen*/
|
---|
291 | {jjtn000.setBeginOffset(charStream.getBeginOffset());}
|
---|
292 |
|
---|
293 | <IDENTIFIER> {
|
---|
294 | jjtn000.setClassName(token.image);
|
---|
295 | }
|
---|
296 | <SINGLE_SECT_START> (<SINGLE_SECT_END>|<EOF>)
|
---|
297 |
|
---|
298 | (Property() | CodeSection() )*/*@bgen(jjtree)*/
|
---|
299 | {
|
---|
300 | jjtree.closeNodeScope(jjtn000, true);
|
---|
301 | jjtc000 = false;
|
---|
302 | }
|
---|
303 | /*@egen*/
|
---|
304 |
|
---|
305 | { jjtn000.setEndOffset(charStream.getBeginOffset() - 1); }/*@bgen(jjtree)*/
|
---|
306 | } catch (Throwable jjte000) {
|
---|
307 | if (jjtc000) {
|
---|
308 | jjtree.clearNodeScope(jjtn000);
|
---|
309 | jjtc000 = false;
|
---|
310 | } else {
|
---|
311 | jjtree.popNode();
|
---|
312 | }
|
---|
313 | if (jjte000 instanceof RuntimeException) {
|
---|
314 | throw (RuntimeException)jjte000;
|
---|
315 | }
|
---|
316 | if (jjte000 instanceof ParseException) {
|
---|
317 | throw (ParseException)jjte000;
|
---|
318 | }
|
---|
319 | throw (Error)jjte000;
|
---|
320 | } finally {
|
---|
321 | if (jjtc000) {
|
---|
322 | jjtree.closeNodeScope(jjtn000, true);
|
---|
323 | }
|
---|
324 | }
|
---|
325 | /*@egen*/
|
---|
326 | }
|
---|
327 |
|
---|
328 | void CodeSection() : {/*@bgen(jjtree) CodeSection */
|
---|
329 | ASTCodeSection jjtn000 = new ASTCodeSection(JJTCODESECTION);
|
---|
330 | boolean jjtc000 = true;
|
---|
331 | jjtree.openNodeScope(jjtn000);
|
---|
332 | /*@egen*/}
|
---|
333 | {/*@bgen(jjtree) CodeSection */
|
---|
334 | try {
|
---|
335 | /*@egen*/
|
---|
336 | { jjtn000.setBeginOffset(charStream.getBeginOffset()); }
|
---|
337 | <CODE_SECTION_START> (GlobalDecl() | Function() | IncludeStmt())* <CODE_SECTION_END>/*@bgen(jjtree)*/
|
---|
338 | {
|
---|
339 | jjtree.closeNodeScope(jjtn000, true);
|
---|
340 | jjtc000 = false;
|
---|
341 | }
|
---|
342 | /*@egen*/
|
---|
343 |
|
---|
344 | { jjtn000.setEndOffset(charStream.getBeginOffset()); }/*@bgen(jjtree)*/
|
---|
345 | } catch (Throwable jjte000) {
|
---|
346 | if (jjtc000) {
|
---|
347 | jjtree.clearNodeScope(jjtn000);
|
---|
348 | jjtc000 = false;
|
---|
349 | } else {
|
---|
350 | jjtree.popNode();
|
---|
351 | }
|
---|
352 | if (jjte000 instanceof RuntimeException) {
|
---|
353 | throw (RuntimeException)jjte000;
|
---|
354 | }
|
---|
355 | if (jjte000 instanceof ParseException) {
|
---|
356 | throw (ParseException)jjte000;
|
---|
357 | }
|
---|
358 | throw (Error)jjte000;
|
---|
359 | } finally {
|
---|
360 | if (jjtc000) {
|
---|
361 | jjtree.closeNodeScope(jjtn000, true);
|
---|
362 | }
|
---|
363 | }
|
---|
364 | /*@egen*/
|
---|
365 | }
|
---|
366 |
|
---|
367 | void Function() : {/*@bgen(jjtree) Function */
|
---|
368 | ASTFunction jjtn000 = new ASTFunction(JJTFUNCTION);
|
---|
369 | boolean jjtc000 = true;
|
---|
370 | jjtree.openNodeScope(jjtn000);
|
---|
371 | /*@egen*/}
|
---|
372 | {/*@bgen(jjtree) Function */
|
---|
373 | try {
|
---|
374 | /*@egen*/
|
---|
375 |
|
---|
376 | try{
|
---|
377 | <FUNCTION_KWD> { jjtn000.setBeginOffset(charStream.getBeginOffset()); } IdentList()
|
---|
378 | <LPAREN> [ IdentList() ] <RPAREN> <LBRACE> (CodeBlock())* <RBRACE>
|
---|
379 | }
|
---|
380 | catch(ParseException e)
|
---|
381 | {
|
---|
382 | token_source.SwitchTo(DEFAULT);
|
---|
383 | //error_skipto(new int[] { EOF });
|
---|
384 | }/*@bgen(jjtree)*/
|
---|
385 | {
|
---|
386 | jjtree.closeNodeScope(jjtn000, true);
|
---|
387 | jjtc000 = false;
|
---|
388 | }
|
---|
389 | /*@egen*/
|
---|
390 |
|
---|
391 | { jjtn000.setEndOffset(charStream.getBeginOffset()); }/*@bgen(jjtree)*/
|
---|
392 | } catch (Throwable jjte000) {
|
---|
393 | if (jjtc000) {
|
---|
394 | jjtree.clearNodeScope(jjtn000);
|
---|
395 | jjtc000 = false;
|
---|
396 | } else {
|
---|
397 | jjtree.popNode();
|
---|
398 | }
|
---|
399 | if (jjte000 instanceof RuntimeException) {
|
---|
400 | throw (RuntimeException)jjte000;
|
---|
401 | }
|
---|
402 | if (jjte000 instanceof ParseException) {
|
---|
403 | throw (ParseException)jjte000;
|
---|
404 | }
|
---|
405 | throw (Error)jjte000;
|
---|
406 | } finally {
|
---|
407 | if (jjtc000) {
|
---|
408 | jjtree.closeNodeScope(jjtn000, true);
|
---|
409 | }
|
---|
410 | }
|
---|
411 | /*@egen*/
|
---|
412 | }
|
---|
413 |
|
---|
414 | void GlobalDecl() : {/*@bgen(jjtree) GlobalDecl */
|
---|
415 | ASTGlobalDecl jjtn000 = new ASTGlobalDecl(JJTGLOBALDECL);
|
---|
416 | boolean jjtc000 = true;
|
---|
417 | jjtree.openNodeScope(jjtn000);
|
---|
418 | /*@egen*/}
|
---|
419 | {/*@bgen(jjtree) GlobalDecl */
|
---|
420 | try {
|
---|
421 | /*@egen*/
|
---|
422 | { jjtn000.setBeginOffset(charStream.getBeginOffset()); }
|
---|
423 | <GLOBAL_KWD> IdentList() <SEMICOLON>/*@bgen(jjtree)*/
|
---|
424 | {
|
---|
425 | jjtree.closeNodeScope(jjtn000, true);
|
---|
426 | jjtc000 = false;
|
---|
427 | }
|
---|
428 | /*@egen*/
|
---|
429 | { jjtn000.setEndOffset(charStream.getBeginOffset()); }/*@bgen(jjtree)*/
|
---|
430 | } catch (Throwable jjte000) {
|
---|
431 | if (jjtc000) {
|
---|
432 | jjtree.clearNodeScope(jjtn000);
|
---|
433 | jjtc000 = false;
|
---|
434 | } else {
|
---|
435 | jjtree.popNode();
|
---|
436 | }
|
---|
437 | if (jjte000 instanceof RuntimeException) {
|
---|
438 | throw (RuntimeException)jjte000;
|
---|
439 | }
|
---|
440 | if (jjte000 instanceof ParseException) {
|
---|
441 | throw (ParseException)jjte000;
|
---|
442 | }
|
---|
443 | throw (Error)jjte000;
|
---|
444 | } finally {
|
---|
445 | if (jjtc000) {
|
---|
446 | jjtree.closeNodeScope(jjtn000, true);
|
---|
447 | }
|
---|
448 | }
|
---|
449 | /*@egen*/
|
---|
450 | }
|
---|
451 |
|
---|
452 | void IncludeStmt() : {/*@bgen(jjtree) IncludeStmt */
|
---|
453 | ASTIncludeStmt jjtn000 = new ASTIncludeStmt(JJTINCLUDESTMT);
|
---|
454 | boolean jjtc000 = true;
|
---|
455 | jjtree.openNodeScope(jjtn000);
|
---|
456 | /*@egen*/}
|
---|
457 | {/*@bgen(jjtree) IncludeStmt */
|
---|
458 | try {
|
---|
459 | /*@egen*/
|
---|
460 | { jjtn000.setBeginOffset(charStream.getBeginOffset()); }
|
---|
461 | <INCLUDE_KWD> <STRING_LITERAL> { jjtn000.setFileName(token.image); }/*@bgen(jjtree)*/
|
---|
462 | {
|
---|
463 | jjtree.closeNodeScope(jjtn000, true);
|
---|
464 | jjtc000 = false;
|
---|
465 | }
|
---|
466 | /*@egen*/
|
---|
467 | { jjtn000.setEndOffset(charStream.getOffset()); }/*@bgen(jjtree)*/
|
---|
468 | } finally {
|
---|
469 | if (jjtc000) {
|
---|
470 | jjtree.closeNodeScope(jjtn000, true);
|
---|
471 | }
|
---|
472 | }
|
---|
473 | /*@egen*/
|
---|
474 | }
|
---|
475 |
|
---|
476 | void GlobalInclude() : {/*@bgen(jjtree) GlobalInclude */
|
---|
477 | ASTGlobalInclude jjtn000 = new ASTGlobalInclude(JJTGLOBALINCLUDE);
|
---|
478 | boolean jjtc000 = true;
|
---|
479 | jjtree.openNodeScope(jjtn000);
|
---|
480 | /*@egen*/}
|
---|
481 | {/*@bgen(jjtree) GlobalInclude */
|
---|
482 | try {
|
---|
483 | /*@egen*/
|
---|
484 | { jjtn000.setBeginOffset(charStream.getBeginOffset()); }
|
---|
485 | <GLOBAL_INCLUDE_KWD> <INCLUDE_STRING> { jjtn000.setFileName(token.image); }/*@bgen(jjtree)*/
|
---|
486 | {
|
---|
487 | jjtree.closeNodeScope(jjtn000, true);
|
---|
488 | jjtc000 = false;
|
---|
489 | }
|
---|
490 | /*@egen*/
|
---|
491 | { jjtn000.setEndOffset(charStream.getOffset()); }/*@bgen(jjtree)*/
|
---|
492 | } finally {
|
---|
493 | if (jjtc000) {
|
---|
494 | jjtree.closeNodeScope(jjtn000, true);
|
---|
495 | }
|
---|
496 | }
|
---|
497 | /*@egen*/
|
---|
498 | }
|
---|
499 |
|
---|
500 | void IdentList() : {/*@bgen(jjtree) IdentList */
|
---|
501 | ASTIdentList jjtn000 = new ASTIdentList(JJTIDENTLIST);
|
---|
502 | boolean jjtc000 = true;
|
---|
503 | jjtree.openNodeScope(jjtn000);
|
---|
504 | /*@egen*/}
|
---|
505 | {/*@bgen(jjtree) IdentList */
|
---|
506 | try {
|
---|
507 | /*@egen*/
|
---|
508 | <IDENT> { jjtn000.addIdent(token.image); } (<COMMA> <IDENT> { jjtn000.addIdent(token.image); } )*/*@bgen(jjtree)*/
|
---|
509 | } finally {
|
---|
510 | if (jjtc000) {
|
---|
511 | jjtree.closeNodeScope(jjtn000, true);
|
---|
512 | }
|
---|
513 | }
|
---|
514 | /*@egen*/
|
---|
515 | }
|
---|
516 |
|
---|
517 | void Property() : {/*@bgen(jjtree) Property */
|
---|
518 | ASTProperty jjtn000 = new ASTProperty(JJTPROPERTY);
|
---|
519 | boolean jjtc000 = true;
|
---|
520 | jjtree.openNodeScope(jjtn000);
|
---|
521 | /*@egen*/}
|
---|
522 | {/*@bgen(jjtree) Property */
|
---|
523 | try {
|
---|
524 | /*@egen*/
|
---|
525 | { jjtn000.setBeginOffset(charStream.getBeginOffset()); }
|
---|
526 |
|
---|
527 | <IDENTIFIER> { jjtn000.setName(token.image); }
|
---|
528 |
|
---|
529 | ( SingleLinePropertyValue()/*@bgen(jjtree)*/
|
---|
530 | {
|
---|
531 | jjtree.closeNodeScope(jjtn000, true);
|
---|
532 | jjtc000 = false;
|
---|
533 | }
|
---|
534 | /*@egen*/ { jjtn000.setEndOffset(charStream.getBeginOffset() - 1); } | MultiLinePropertyValue()/*@bgen(jjtree)*/
|
---|
535 | {
|
---|
536 | jjtree.closeNodeScope(jjtn000, true);
|
---|
537 | jjtc000 = false;
|
---|
538 | }
|
---|
539 | /*@egen*/ { jjtn000.setEndOffset(charStream.getBeginOffset()); } )/*@bgen(jjtree)*/
|
---|
540 | } catch (Throwable jjte000) {
|
---|
541 | if (jjtc000) {
|
---|
542 | jjtree.clearNodeScope(jjtn000);
|
---|
543 | jjtc000 = false;
|
---|
544 | } else {
|
---|
545 | jjtree.popNode();
|
---|
546 | }
|
---|
547 | if (jjte000 instanceof RuntimeException) {
|
---|
548 | throw (RuntimeException)jjte000;
|
---|
549 | }
|
---|
550 | if (jjte000 instanceof ParseException) {
|
---|
551 | throw (ParseException)jjte000;
|
---|
552 | }
|
---|
553 | throw (Error)jjte000;
|
---|
554 | } finally {
|
---|
555 | if (jjtc000) {
|
---|
556 | jjtree.closeNodeScope(jjtn000, true);
|
---|
557 | }
|
---|
558 | }
|
---|
559 | /*@egen*/
|
---|
560 |
|
---|
561 | }
|
---|
562 |
|
---|
563 | void SingleLinePropertyValue() : {/*@bgen(jjtree) SingleLinePropertyValue */
|
---|
564 | ASTSingleLinePropertyValue jjtn000 = new ASTSingleLinePropertyValue(JJTSINGLELINEPROPERTYVALUE);
|
---|
565 | boolean jjtc000 = true;
|
---|
566 | jjtree.openNodeScope(jjtn000);
|
---|
567 | /*@egen*/}
|
---|
568 | {/*@bgen(jjtree) SingleLinePropertyValue */
|
---|
569 | try {
|
---|
570 | /*@egen*/
|
---|
571 | <SINGLE_SECT_START> <PROP_VALUE>{ jjtn000.setValue(token.image); } (<SINGLE_SECT_END>| <EOF>)/*@bgen(jjtree)*/
|
---|
572 | } finally {
|
---|
573 | if (jjtc000) {
|
---|
574 | jjtree.closeNodeScope(jjtn000, true);
|
---|
575 | }
|
---|
576 | }
|
---|
577 | /*@egen*/
|
---|
578 | }
|
---|
579 |
|
---|
580 | void CodeBlock() : {}
|
---|
581 | {
|
---|
582 | <NESTED_LBRACE> (CodeBlock())* <RBRACE>
|
---|
583 | }
|
---|
584 |
|
---|
585 | void MultiLinePropertyValue() : {/*@bgen(jjtree) MultiLinePropertyValue */
|
---|
586 | ASTMultiLinePropertyValue jjtn000 = new ASTMultiLinePropertyValue(JJTMULTILINEPROPERTYVALUE);
|
---|
587 | boolean jjtc000 = true;
|
---|
588 | jjtree.openNodeScope(jjtn000);
|
---|
589 | /*@egen*/}
|
---|
590 | {/*@bgen(jjtree) MultiLinePropertyValue */
|
---|
591 | try {
|
---|
592 | /*@egen*/
|
---|
593 | <MULTI_SECT_START> <MULTILINE_PROP_VALUE> <MULTI_SECT_END>/*@bgen(jjtree)*/
|
---|
594 | } finally {
|
---|
595 | if (jjtc000) {
|
---|
596 | jjtree.closeNodeScope(jjtn000, true);
|
---|
597 | }
|
---|
598 | }
|
---|
599 | /*@egen*/
|
---|
600 | }
|
---|
601 |
|
---|
602 | JAVACODE
|
---|
603 | void error_skipto(int[] kinds) {
|
---|
604 | //ParseException e = generateParseException(); // generate the exception object.
|
---|
605 | //System.out.println(e.toString()); // print the error message
|
---|
606 | Token t;
|
---|
607 | if(kinds.length > 0)
|
---|
608 | {
|
---|
609 | java.util.Arrays.sort(kinds);
|
---|
610 |
|
---|
611 | do {
|
---|
612 | t = getNextToken();
|
---|
613 | } while (java.util.Arrays.binarySearch(kinds, t.kind) < 0);
|
---|
614 |
|
---|
615 | }
|
---|
616 | } |
---|