KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javacc > jjtree > ASTCompilationUnit


1 /*
2  * Copyright © 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
3  * California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has
4  * intellectual property rights relating to technology embodied in the product
5  * that is described in this document. In particular, and without limitation,
6  * these intellectual property rights may include one or more of the U.S.
7  * patents listed at http://www.sun.com/patents and one or more additional
8  * patents or pending patent applications in the U.S. and in other countries.
9  * U.S. Government Rights - Commercial software. Government users are subject
10  * to the Sun Microsystems, Inc. standard license agreement and applicable
11  * provisions of the FAR and its supplements. Use is subject to license terms.
12  * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
13  * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This
14  * product is covered and controlled by U.S. Export Control laws and may be
15  * subject to the export or import laws in other countries. Nuclear, missile,
16  * chemical biological weapons or nuclear maritime end uses or end users,
17  * whether direct or indirect, are strictly prohibited. Export or reexport
18  * to countries subject to U.S. embargo or to entities identified on U.S.
19  * export exclusion lists, including, but not limited to, the denied persons
20  * and specially designated nationals lists is strictly prohibited.
21  */

22
23 package org.javacc.jjtree;
24
25
26 public class ASTCompilationUnit extends SimpleNode {
27   ASTCompilationUnit(int id) {
28     super(id);
29   }
30
31
32   public void print(IO io)
33   {
34     Token t = getFirstToken();
35
36     while (true) {
37       if (t == JJTreeGlobals.parserImplements) {
38     if (t.image.equals("implements")) {
39       print(t, io);
40       openJJTreeComment(io, null);
41       io.getOut().print(" " + NodeFiles.nodeConstants() + ", ");
42       closeJJTreeComment(io);
43     } else {
44       // t is pointing at the opening brace of the class body.
45
openJJTreeComment(io, null);
46       io.getOut().print("implements " + NodeFiles.nodeConstants());
47       closeJJTreeComment(io);
48       print(t, io);
49     }
50       } else {
51     print(t, io);
52       }
53       if (t == JJTreeGlobals.parserClassBodyStart) {
54     openJJTreeComment(io, null);
55     JJTreeState.insertParserMembers(io);
56     closeJJTreeComment(io);
57       }
58
59       if (t == getLastToken()) {
60     return;
61       }
62       t = t.next;
63     }
64   }
65
66 }
67
68 /*end*/
69
Popular Tags