Organized imports
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ISourceElementRequestor.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler;
12
13 import net.sourceforge.phpdt.core.compiler.IProblem;
14
15 /*
16  * Part of the source element parser responsible for building the output.
17  * It gets notified of structural information as they are detected, relying
18  * on the requestor to assemble them together, based on the notifications it got.
19  *
20  * The structural investigation includes:
21  * - package statement
22  * - import statements
23  * - top-level types: package member, member types (member types of member types...)
24  * - fields
25  * - methods
26  *
27  * If reference information is requested, then all source constructs are
28  * investigated and type, field & method references are provided as well.
29  *
30  * Any (parsing) problem encountered is also provided.
31  *
32  * All positions are relative to the exact source fed to the parser.
33  *
34  * Elements which are complex are notified in two steps:
35  * - enter<Element> : once the element header has been identified
36  * - exit<Element> : once the element has been fully consumed
37  *
38  * other simpler elements (package, import) are read all at once:
39  * - accept<Element>
40  */
41
42 public interface ISourceElementRequestor {
43   void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition);
44   //void acceptFieldReference(char[] fieldName, int sourcePosition);
45   /**
46    * @param declarationStart This is the position of the first character of the
47    *                                               import keyword.
48    * @param declarationEnd This is the position of the ';' ending the import statement
49    *                                             or the end of the comment following the import.
50    * @param name This is the name of the import like specified in the source including the dots. The '.*'
51    *             is never included in the name.
52    * @param onDemand set to true if the import is an import on demand (e.g. import java.io.*). False otherwise.
53    */
54   void acceptImport(
55         int declarationStart,
56         int declarationEnd,
57         char[] name,
58         boolean onDemand);
59   /*
60    * Table of line separator position. This table is passed once at the end
61    * of the parse action, so as to allow computation of normalized ranges.
62    *
63    * A line separator might corresponds to several characters in the source,
64    * 
65    */
66   void acceptLineSeparatorPositions(int[] positions);
67   void acceptMethodReference(char[] methodName, int argCount, int sourcePosition);
68   //void acceptPackage(
69   //    int declarationStart,
70   //    int declarationEnd,
71   //    char[] name);
72   void acceptProblem(IProblem problem);
73   void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
74   void acceptTypeReference(char[] typeName, int sourcePosition);
75   void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
76   void acceptUnknownReference(char[] name, int sourcePosition);
77   void enterClass(
78     int declarationStart,
79     int modifiers,
80     char[] name,
81     int nameSourceStart,
82     int nameSourceEnd,
83     char[] superclass,
84     char[][] superinterfaces);
85   void enterCompilationUnit();
86   void enterConstructor(
87     int declarationStart,
88     int modifiers,
89     char[] name,
90     int nameSourceStart,
91     int nameSourceEnd,
92     char[][] parameterTypes,
93     char[][] parameterNames,
94     char[][] exceptionTypes);
95   void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd);
96   //void enterInitializer(
97   //    int declarationStart,
98   //    int modifiers);
99   void enterInterface(
100     int declarationStart,
101     int modifiers,
102     char[] name,
103     int nameSourceStart,
104     int nameSourceEnd,
105     char[][] superinterfaces);
106   void enterMethod(
107     int declarationStart,
108     int modifiers,
109     char[] returnType,
110     char[] name,
111     int nameSourceStart,
112     int nameSourceEnd,
113     char[][] parameterTypes,
114     char[][] parameterNames,
115     char[][] exceptionTypes);
116   void exitClass(int declarationEnd);
117   void exitCompilationUnit(int declarationEnd);
118   void exitConstructor(int declarationEnd);
119   /*
120    * initializationStart denotes the source start of the expression used for initializing
121    * the field if any (-1 if no initialization).
122    */
123   void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd);
124   void exitInitializer(int declarationEnd);
125   void exitInterface(int declarationEnd);
126   void exitMethod(int declarationEnd);
127 }