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. It
17 * gets notified of structural information as they are detected, relying on the
18 * requestor to assemble them together, based on the notifications it got.
20 * The structural investigation includes: - package statement - import
21 * statements - top-level types: package member, member types (member types of
22 * member types...) - fields - methods
24 * If reference information is requested, then all source constructs are
25 * investigated and type, field & method references are provided as well.
27 * Any (parsing) problem encountered is also provided.
29 * All positions are relative to the exact source fed to the parser.
31 * Elements which are complex are notified in two steps: - enter<Element> :
32 * once the element header has been identified - exit<Element> : once the
33 * element has been fully consumed
35 * other simpler elements (package, import) are read all at once: - accept<Element>
38 public interface ISourceElementRequestor {
39 void acceptConstructorReference(char[] typeName, int argCount,
42 // void acceptFieldReference(char[] fieldName, int sourcePosition);
44 * @param declarationStart
45 * This is the position of the first character of the import
47 * @param declarationEnd
48 * This is the position of the ';' ending the import statement or
49 * the end of the comment following the import.
51 * This is the name of the import like specified in the source
52 * including the dots. The '.*' is never included in the name.
54 * set to true if the import is an import on demand (e.g. import
55 * java.io.*). False otherwise.
57 void acceptImport(int declarationStart, int declarationEnd, char[] name,
61 * Table of line separator position. This table is passed once at the end of
62 * the parse action, so as to allow computation of normalized ranges.
64 * A line separator might corresponds to several characters in the source,
67 void acceptLineSeparatorPositions(int[] positions);
69 void acceptMethodReference(char[] methodName, int argCount,
72 // void acceptPackage(
73 // int declarationStart,
74 // int declarationEnd,
76 void acceptProblem(IProblem problem);
78 void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
80 void acceptTypeReference(char[] typeName, int sourcePosition);
82 void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
84 void acceptUnknownReference(char[] name, int sourcePosition);
86 void enterClass(int declarationStart, int modifiers, char[] name,
87 int nameSourceStart, int nameSourceEnd, char[] superclass,
88 char[][] superinterfaces);
90 void enterCompilationUnit();
92 void enterConstructor(int declarationStart, int modifiers, char[] name,
93 int nameSourceStart, int nameSourceEnd, char[][] parameterTypes,
94 char[][] parameterNames, char[][] exceptionTypes);
96 void enterField(int declarationStart, int modifiers, char[] type,
97 char[] name, int nameSourceStart, int nameSourceEnd);
99 // void enterInitializer(
100 // int declarationStart,
102 void enterInterface(int declarationStart, int modifiers, char[] name,
103 int nameSourceStart, int nameSourceEnd, char[][] superinterfaces);
105 void enterMethod(int declarationStart, int modifiers, char[] returnType,
106 char[] name, int nameSourceStart, int nameSourceEnd,
107 char[][] parameterTypes, char[][] parameterNames,
108 char[][] exceptionTypes);
110 void exitClass(int declarationEnd);
112 void exitCompilationUnit(int declarationEnd);
114 void exitConstructor(int declarationEnd);
117 * initializationStart denotes the source start of the expression used for
118 * initializing the field if any (-1 if no initialization).
120 void exitField(int initializationStart, int declarationEnd,
121 int declarationSourceEnd);
123 void exitInitializer(int declarationEnd);
125 void exitInterface(int declarationEnd);
127 void exitMethod(int declarationEnd);