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 java.util.HashMap;
15 import net.sourceforge.phpdt.core.compiler.IProblem;
18 * Part of the source element parser responsible for building the output.
19 * It gets notified of structural information as they are detected, relying
20 * on the requestor to assemble them together, based on the notifications it got.
22 * The structural investigation includes:
25 * - top-level types: package member, member types (member types of member types...)
29 * If reference information is requested, then all source constructs are
30 * investigated and type, field & method references are provided as well.
32 * Any (parsing) problem encountered is also provided.
34 * All positions are relative to the exact source fed to the parser.
36 * Elements which are complex are notified in two steps:
37 * - enter<Element> : once the element header has been identified
38 * - exit<Element> : once the element has been fully consumed
40 * other simpler elements (package, import) are read all at once:
44 public interface ISourceElementRequestor {
45 void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition);
46 //void acceptFieldReference(char[] fieldName, int sourcePosition);
48 * @param declarationStart This is the position of the first character of the
50 * @param declarationEnd This is the position of the ';' ending the import statement
51 * or the end of the comment following the import.
52 * @param name This is the name of the import like specified in the source including the dots. The '.*'
53 * is never included in the name.
54 * @param onDemand set to true if the import is an import on demand (e.g. import java.io.*). False otherwise.
62 * Table of line separator position. This table is passed once at the end
63 * of the parse action, so as to allow computation of normalized ranges.
65 * A line separator might corresponds to several characters in the source,
68 void acceptLineSeparatorPositions(int[] positions);
69 void acceptMethodReference(char[] methodName, int argCount, int sourcePosition);
71 // int declarationStart,
72 // int declarationEnd,
74 void acceptProblem(IProblem problem);
75 void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
76 void acceptTypeReference(char[] typeName, int sourcePosition);
77 void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
78 void acceptUnknownReference(char[] name, int sourcePosition);
86 char[][] superinterfaces);
87 void enterCompilationUnit();
88 void enterConstructor(
94 char[][] parameterTypes,
95 char[][] parameterNames,
96 char[][] exceptionTypes);
97 void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd);
98 //void enterInitializer(
99 // int declarationStart,
102 int declarationStart,
107 char[][] superinterfaces);
109 int declarationStart,
115 char[][] parameterTypes,
116 char[][] parameterNames,
117 char[][] exceptionTypes);
118 void exitClass(int declarationEnd);
119 void exitCompilationUnit(int declarationEnd);
120 void exitConstructor(int declarationEnd);
122 * initializationStart denotes the source start of the expression used for initializing
123 * the field if any (-1 if no initialization).
125 void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd);
126 void exitInitializer(int declarationEnd);
127 void exitInterface(int declarationEnd);
128 void exitMethod(int declarationEnd);