1/* 2 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package sun.tools.java; 27 28import sun.tools.tree.*; 29 30/** 31 * This is the protocol by which a Parser makes callbacks 32 * to the later phases of the compiler. 33 * <p> 34 * (As a backwards compatibility trick, Parser implements 35 * this protocol, so that an instance of a Parser subclass 36 * can handle its own actions. The preferred way to use a 37 * Parser, however, is to instantiate it directly with a 38 * reference to your own ParserActions implementation.) 39 * 40 * WARNING: The contents of this source file are not part of any 41 * supported API. Code that depends on them does so at its own risk: 42 * they are subject to change or removal without notice. 43 * 44 * @author John R. Rose 45 */ 46public interface ParserActions { 47 /** 48 * package declaration 49 */ 50 void packageDeclaration(long off, IdentifierToken nm); 51 52 /** 53 * import class 54 */ 55 void importClass(long off, IdentifierToken nm); 56 57 /** 58 * import package 59 */ 60 void importPackage(long off, IdentifierToken nm); 61 62 /** 63 * Define class 64 * @return a cookie for the class 65 * This cookie is used by the parser when calling defineField 66 * and endClass, and is not examined otherwise. 67 */ 68 ClassDefinition beginClass(long off, String doc, 69 int mod, IdentifierToken nm, 70 IdentifierToken sup, IdentifierToken impl[]); 71 72 73 /** 74 * End class 75 * @param c a cookie returned by the corresponding beginClass call 76 */ 77 void endClass(long off, ClassDefinition c); 78 79 /** 80 * Define a field 81 * @param c a cookie returned by the corresponding beginClass call 82 */ 83 void defineField(long where, ClassDefinition c, 84 String doc, int mod, Type t, 85 IdentifierToken nm, IdentifierToken args[], 86 IdentifierToken exp[], Node val); 87} 88