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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler;
13 import net.sourceforge.phpdt.core.compiler.IProblem;
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.
20 * The structural investigation includes:
23 * - top-level types: package member, member types (member types of member types...)
27 * If reference information is requested, then all source constructs are
28 * investigated and type, field & method references are provided as well.
30 * Any (parsing) problem encountered is also provided.
32 * All positions are relative to the exact source fed to the parser.
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
38 * other simpler elements (package, import) are read all at once:
42 public interface ISourceElementRequestor {
43 void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition);
44 //void acceptFieldReference(char[] fieldName, int sourcePosition);
46 * @param declarationStart This is the position of the first character of the
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.
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.
63 * A line separator might corresponds to several characters in the source,
66 void acceptLineSeparatorPositions(int[] positions);
67 void acceptMethodReference(char[] methodName, int argCount, int sourcePosition);
69 // int declarationStart,
70 // int declarationEnd,
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);
84 char[][] superinterfaces);
85 void enterCompilationUnit();
86 void enterConstructor(
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,
100 int declarationStart,
105 char[][] superinterfaces);
107 int declarationStart,
113 char[][] parameterTypes,
114 char[][] parameterNames,
115 char[][] exceptionTypes);
116 void exitClass(int declarationEnd);
117 void exitCompilationUnit(int declarationEnd);
118 void exitConstructor(int declarationEnd);
120 * initializationStart denotes the source start of the expression used for initializing
121 * the field if any (-1 if no initialization).
123 void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd);
124 void exitInitializer(int declarationEnd);
125 void exitInterface(int declarationEnd);
126 void exitMethod(int declarationEnd);