private int computePriority(IProblem problem) {
- final int P_STATIC = 1000;
+ //final int P_STATIC = 1000;
final int P_OUTSIDE_METHOD = 4000;
final int P_FIRST_ERROR = 2000;
final int P_ERROR = 10000;
return this.tasks;
}
- public boolean hasErrors() {
-
- if (problems != null)
- for (int i = 0; i < problemCount; i++) {
- if (problems[i].isError())
- return true;
- }
- return false;
- }
-
- public boolean hasProblems() {
-
- return problemCount != 0;
- }
+// public boolean hasErrors() {
+//
+// if (problems != null)
+// for (int i = 0; i < problemCount; i++) {
+// if (problems[i].isError())
+// return true;
+// }
+// return false;
+// }
+
+// public boolean hasProblems() {
+//
+// return problemCount != 0;
+// }
public boolean hasSyntaxError() {
return false;
}
- public boolean hasTasks() {
- return this.taskCount != 0;
- }
-
- public boolean hasWarnings() {
-
- if (problems != null)
- for (int i = 0; i < problemCount; i++) {
- if (problems[i].isWarning())
- return true;
- }
- return false;
- }
+// public boolean hasTasks() {
+// return this.taskCount != 0;
+// }
+
+// public boolean hasWarnings() {
+//
+// if (problems != null)
+// for (int i = 0; i < problemCount; i++) {
+// if (problems[i].isWarning())
+// return true;
+// }
+// return false;
+// }
private static void quickSort(IProblem[] list, int left, int right) {
private int currentValueIndex;
- private int defaultValueIndex;
+ //private int defaultValueIndex;
private String[] possibleValues;
*
* @return int
*/
- public int getDefaultValueIndex() {
- return defaultValueIndex;
- }
+// public int getDefaultValueIndex() {
+// return defaultValueIndex;
+// }
/**
* Return an String that represents the localized description of the
*
* @return java.lang.String[]
*/
- public String[] getPossibleValues() {
- return possibleValues;
- }
+// public String[] getPossibleValues() {
+// return possibleValues;
+// }
/**
* Change the index (in possibleValues array) of the current setting for
*
* @return int
*/
- public void setValueIndex(int newIndex) {
- currentValueIndex = newIndex;
- }
+// public void setValueIndex(int newIndex) {
+// currentValueIndex = newIndex;
+// }
public String toString() {
StringBuffer buffer = new StringBuffer();
return problemReporter;
}
- protected void pushOnIntArrayStack(int[] positions) {
-
- try {
- intArrayStack[++intArrayPtr] = positions;
- } catch (IndexOutOfBoundsException e) {
- // intPtr is correct
- int oldStackLength = intArrayStack.length;
- int oldStack[][] = intArrayStack;
- intArrayStack = new int[oldStackLength + StackIncrement][];
- System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength);
- intArrayStack[intArrayPtr] = positions;
- }
- }
+// protected void pushOnIntArrayStack(int[] positions) {
+//
+// try {
+// intArrayStack[++intArrayPtr] = positions;
+// } catch (IndexOutOfBoundsException e) {
+// // intPtr is correct
+// int oldStackLength = intArrayStack.length;
+// int oldStack[][] = intArrayStack;
+// intArrayStack = new int[oldStackLength + StackIncrement][];
+// System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength);
+// intArrayStack[intArrayPtr] = positions;
+// }
+// }
// protected void resetModifiers() {
// super.resetModifiers();
* Syntax error was detected. Will attempt to perform some recovery action
* in order to resume to the regular parse loop.
*/
- protected boolean resumeOnSyntaxError() {
- return false;
- }
+// protected boolean resumeOnSyntaxError() {
+// return false;
+// }
/*
* Answer a char array representation of the type name formatted like: -
* type name + dimensions Example: "A[][]".toCharArray()
* @deprecated use SourceElementParser(ISourceElementRequestor,
* IProblemFactory, CompilerOptions)
*/
- public SourceElementParser(final ISourceElementRequestor requestor,
- IProblemFactory problemFactory) {
- this(requestor, problemFactory, new CompilerOptions());
- }
+// public SourceElementParser(final ISourceElementRequestor requestor,
+// IProblemFactory problemFactory) {
+// this(requestor, problemFactory, new CompilerOptions());
+// }
- public SourceElementParser(final ISourceElementRequestor requestor,
- IProblemFactory problemFactory, CompilerOptions options,
- boolean reportLocalDeclarations) {
- this(requestor, problemFactory, options);
- if (reportLocalDeclarations) {
- this.localDeclarationVisitor = new LocalDeclarationVisitor();
- }
- }
+// public SourceElementParser(final ISourceElementRequestor requestor,
+// IProblemFactory problemFactory, CompilerOptions options,
+// boolean reportLocalDeclarations) {
+// this(requestor, problemFactory, options);
+// if (reportLocalDeclarations) {
+// this.localDeclarationVisitor = new LocalDeclarationVisitor();
+// }
+// }
// public void checkAnnotation() {
// int firstCommentIndex = scanner.commentPtr;
}
}
- public void parseCompilationUnit(ICompilationUnit unit, int start, int end) {
- // boolean needReferenceInfo) {
-
- // reportReferenceInfo = needReferenceInfo;
- // boolean old = diet;
- // if (needReferenceInfo) {
- // unknownRefs = new NameReference[10];
- // unknownRefsCounter = 0;
- // }
-
- try {
- // diet = true;
-// CompilationResult compilationUnitResult = new CompilationResult(
-// unit, 0, 0, 10); // this.options.maxProblemsPerUnit);
-// CompilationUnitDeclaration parsedUnit = parse(unit,
-// compilationUnitResult, start, end);
- // if (scanner.recordLineSeparator) {
- // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
- // }
- // if (this.localDeclarationVisitor != null || needReferenceInfo){
- // diet = false;
- // this.getMethodBodies(parsedUnit);
- // }
- // this.scanner.resetTo(start, end);
- // notifySourceElementRequestor(parsedUnit);
- } catch (AbortCompilation e) {
- } finally {
- // diet = old;
- }
- }
+// public void parseCompilationUnit(ICompilationUnit unit, int start, int end) {
+// // boolean needReferenceInfo) {
+//
+// // reportReferenceInfo = needReferenceInfo;
+// // boolean old = diet;
+// // if (needReferenceInfo) {
+// // unknownRefs = new NameReference[10];
+// // unknownRefsCounter = 0;
+// // }
+//
+// try {
+// // diet = true;
+//// CompilationResult compilationUnitResult = new CompilationResult(
+//// unit, 0, 0, 10); // this.options.maxProblemsPerUnit);
+//// CompilationUnitDeclaration parsedUnit = parse(unit,
+//// compilationUnitResult, start, end);
+// // if (scanner.recordLineSeparator) {
+// // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+// // }
+// // if (this.localDeclarationVisitor != null || needReferenceInfo){
+// // diet = false;
+// // this.getMethodBodies(parsedUnit);
+// // }
+// // this.scanner.resetTo(start, end);
+// // notifySourceElementRequestor(parsedUnit);
+// } catch (AbortCompilation e) {
+// } finally {
+// // diet = old;
+// }
+// }
public CompilationUnitDeclaration parseCompilationUnit(
ICompilationUnit unit, boolean fullParse) {
return null;
}
- public CompilationUnitDeclaration parseCompletionUnit(
- ICompilationUnit unit, boolean fullParse) {
-
- // boolean old = diet;
- // if (fullParse) {
- // unknownRefs = new NameReference[10];
- // unknownRefsCounter = 0;
- // }
-
- try {
- // diet = true;
- this.reportReferenceInfo = fullParse;
- CompilationResult compilationUnitResult = new CompilationResult(
- unit, 0, 0, this.options.maxProblemsPerUnit);
- CompilationUnitDeclaration parsedUnit = parse(unit,
- compilationUnitResult, false);
- // if (scanner.recordLineSeparator) {
- // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
- // }
- // int initialStart = this.scanner.initialPosition;
- // int initialEnd = this.scanner.eofPosition;
- // // if (this.localDeclarationVisitor != null || fullParse){
- // // diet = false;
- // // this.getMethodBodies(parsedUnit);
- // // }
- // this.scanner.resetTo(initialStart, initialEnd);
- // notifySourceElementRequestor(parsedUnit);
- return parsedUnit;
- } catch (AbortCompilation e) {
- // ignore this exception
- } finally {
- // diet = old;
- }
- return null;
- }
+// public CompilationUnitDeclaration parseCompletionUnit(
+// ICompilationUnit unit, boolean fullParse) {
+//
+// // boolean old = diet;
+// // if (fullParse) {
+// // unknownRefs = new NameReference[10];
+// // unknownRefsCounter = 0;
+// // }
+//
+// try {
+// // diet = true;
+// this.reportReferenceInfo = fullParse;
+// CompilationResult compilationUnitResult = new CompilationResult(
+// unit, 0, 0, this.options.maxProblemsPerUnit);
+// CompilationUnitDeclaration parsedUnit = parse(unit,
+// compilationUnitResult, false);
+// // if (scanner.recordLineSeparator) {
+// // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+// // }
+// // int initialStart = this.scanner.initialPosition;
+// // int initialEnd = this.scanner.eofPosition;
+// // // if (this.localDeclarationVisitor != null || fullParse){
+// // // diet = false;
+// // // this.getMethodBodies(parsedUnit);
+// // // }
+// // this.scanner.resetTo(initialStart, initialEnd);
+// // notifySourceElementRequestor(parsedUnit);
+// return parsedUnit;
+// } catch (AbortCompilation e) {
+// // ignore this exception
+// } finally {
+// // diet = old;
+// }
+// return null;
+// }
// public void parseTypeMemberDeclarations(
// ISourceType sourceType,
return CharOperation.concatWith(type.getTypeName(), '.');
}
- public void addUnknownRef(NameReference nameRef) {
- if (this.unknownRefs.length == this.unknownRefsCounter) {
- // resize
- System
- .arraycopy(
- this.unknownRefs,
- 0,
- (this.unknownRefs = new NameReference[this.unknownRefsCounter * 2]),
- 0, this.unknownRefsCounter);
- }
- this.unknownRefs[this.unknownRefsCounter++] = nameRef;
- }
+// public void addUnknownRef(NameReference nameRef) {
+// if (this.unknownRefs.length == this.unknownRefsCounter) {
+// // resize
+// System
+// .arraycopy(
+// this.unknownRefs,
+// 0,
+// (this.unknownRefs = new NameReference[this.unknownRefsCounter * 2]),
+// 0, this.unknownRefsCounter);
+// }
+// this.unknownRefs[this.unknownRefsCounter++] = nameRef;
+// }
private void visitIfNeeded(AbstractMethodDeclaration method) {
if (this.localDeclarationVisitor != null
import java.util.Hashtable;
import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer;
-import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants;
+//import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants;
public class ClasspathDirectory implements FileSystem.Classpath,
SuffixConstants {
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.batch;
-
-import java.io.File;
-
-public class FileFinder {
- private static final int INITIAL_SIZE = 10;
-
- public String[] resultFiles = new String[INITIAL_SIZE];
-
- public int count = 0;
-
- public void find(File f, String pattern, boolean verbose) {
- if (verbose) {
- // System.out.println(Main.bind("scanning.start",f.getAbsolutePath()));
- // //$NON-NLS-1$
- }
- find0(f, pattern, verbose);
- System.arraycopy(this.resultFiles, 0,
- (this.resultFiles = new String[this.count]), 0, this.count);
- }
-
- public void find0(File f, String pattern, boolean verbose) {
- if (f.isDirectory()) {
- String[] files = f.list();
- if (files == null)
- return;
- for (int i = 0, max = files.length; i < max; i++) {
- File current = new File(f, files[i]);
- if (current.isDirectory()) {
- find0(current, pattern, verbose);
- } else {
- if (current.getName().toUpperCase().endsWith(pattern)) {
- int length;
- if ((length = this.resultFiles.length) == this.count) {
- System
- .arraycopy(
- this.resultFiles,
- 0,
- (this.resultFiles = new String[length * 2]),
- 0, length);
- }
- this.resultFiles[this.count++] = current
- .getAbsolutePath();
- if (verbose && (this.count % 100) == 0)
- System.out.print('.');
- }
- }
- }
- }
- }
-}
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment;
import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer;
-import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants;
+//import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants;
public class FileSystem implements INameEnvironment, SuffixConstants {
Classpath[] classpaths;
* '.java' will be removed if its not already.
*/
- public FileSystem(String[] classpathNames, String[] initialFileNames,
- String encoding) {
- this(classpathNames, initialFileNames, encoding, null);
- }
-
- public FileSystem(String[] classpathNames, String[] initialFileNames,
- String encoding, int[] classpathDirectoryModes) {
- int classpathSize = classpathNames.length;
- this.classpaths = new Classpath[classpathSize];
- String[] pathNames = new String[classpathSize];
- int problemsOccured = 0;
- for (int i = 0; i < classpathSize; i++) {
- // try {
- File file = new File(convertPathSeparators(classpathNames[i]));
- if (file.isDirectory()) {
- if (file.exists()) {
- if (classpathDirectoryModes == null) {
- this.classpaths[i] = new ClasspathDirectory(file,
- encoding);
- } else {
- this.classpaths[i] = new ClasspathDirectory(file,
- encoding, classpathDirectoryModes[i]);
- }
- pathNames[i] = ((ClasspathDirectory) this.classpaths[i]).path;
- }
- } else {
- //String lowercaseClasspathName = classpathNames[i].toLowerCase();
- // if (lowercaseClasspathName.endsWith(SUFFIX_STRING_jar)
- // || lowercaseClasspathName.endsWith(SUFFIX_STRING_zip)) {
- // this.classpaths[i] = this.getClasspathJar(file); // will
- // throw an IOException if file does not exist
- // pathNames[i] = classpathNames[i].substring(0,
- // classpathNames[i].lastIndexOf('.'));
- // }
- }
- // } catch (IOException e) {
- // this.classpaths[i] = null;
- // }
- if (this.classpaths[i] == null)
- problemsOccured++;
- }
- if (problemsOccured > 0) {
- Classpath[] newPaths = new Classpath[classpathSize
- - problemsOccured];
- String[] newNames = new String[classpathSize - problemsOccured];
- for (int i = 0, current = 0; i < classpathSize; i++)
- if (this.classpaths[i] != null) {
- newPaths[current] = this.classpaths[i];
- newNames[current++] = pathNames[i];
- }
- classpathSize = newPaths.length;
- this.classpaths = newPaths;
- pathNames = newNames;
- }
-
- this.knownFileNames = new String[initialFileNames.length];
- for (int i = initialFileNames.length; --i >= 0;) {
- String fileName = initialFileNames[i];
- String matchingPathName = null;
- if (fileName.lastIndexOf(".") != -1) //$NON-NLS-1$
- fileName = fileName.substring(0, fileName.lastIndexOf('.')); // remove
- // trailing
- // ".java"
-
- fileName = convertPathSeparators(fileName);
- for (int j = 0; j < classpathSize; j++)
- if (fileName.startsWith(pathNames[j]))
- matchingPathName = pathNames[j];
- if (matchingPathName == null)
- this.knownFileNames[i] = fileName; // leave as is...
- else
- this.knownFileNames[i] = fileName.substring(matchingPathName
- .length());
- }
- }
+// public FileSystem(String[] classpathNames, String[] initialFileNames,
+// String encoding) {
+// this(classpathNames, initialFileNames, encoding, null);
+// }
+
+// public FileSystem(String[] classpathNames, String[] initialFileNames,
+// String encoding, int[] classpathDirectoryModes) {
+// int classpathSize = classpathNames.length;
+// this.classpaths = new Classpath[classpathSize];
+// String[] pathNames = new String[classpathSize];
+// int problemsOccured = 0;
+// for (int i = 0; i < classpathSize; i++) {
+// // try {
+// File file = new File(convertPathSeparators(classpathNames[i]));
+// if (file.isDirectory()) {
+// if (file.exists()) {
+// if (classpathDirectoryModes == null) {
+// this.classpaths[i] = new ClasspathDirectory(file,
+// encoding);
+// } else {
+// this.classpaths[i] = new ClasspathDirectory(file,
+// encoding, classpathDirectoryModes[i]);
+// }
+// pathNames[i] = ((ClasspathDirectory) this.classpaths[i]).path;
+// }
+// } else {
+// //String lowercaseClasspathName = classpathNames[i].toLowerCase();
+// // if (lowercaseClasspathName.endsWith(SUFFIX_STRING_jar)
+// // || lowercaseClasspathName.endsWith(SUFFIX_STRING_zip)) {
+// // this.classpaths[i] = this.getClasspathJar(file); // will
+// // throw an IOException if file does not exist
+// // pathNames[i] = classpathNames[i].substring(0,
+// // classpathNames[i].lastIndexOf('.'));
+// // }
+// }
+// // } catch (IOException e) {
+// // this.classpaths[i] = null;
+// // }
+// if (this.classpaths[i] == null)
+// problemsOccured++;
+// }
+// if (problemsOccured > 0) {
+// Classpath[] newPaths = new Classpath[classpathSize
+// - problemsOccured];
+// String[] newNames = new String[classpathSize - problemsOccured];
+// for (int i = 0, current = 0; i < classpathSize; i++)
+// if (this.classpaths[i] != null) {
+// newPaths[current] = this.classpaths[i];
+// newNames[current++] = pathNames[i];
+// }
+// classpathSize = newPaths.length;
+// this.classpaths = newPaths;
+// pathNames = newNames;
+// }
+//
+// this.knownFileNames = new String[initialFileNames.length];
+// for (int i = initialFileNames.length; --i >= 0;) {
+// String fileName = initialFileNames[i];
+// String matchingPathName = null;
+// if (fileName.lastIndexOf(".") != -1) //$NON-NLS-1$
+// fileName = fileName.substring(0, fileName.lastIndexOf('.')); // remove
+// // trailing
+// // ".java"
+//
+// fileName = convertPathSeparators(fileName);
+// for (int j = 0; j < classpathSize; j++)
+// if (fileName.startsWith(pathNames[j]))
+// matchingPathName = pathNames[j];
+// if (matchingPathName == null)
+// this.knownFileNames[i] = fileName; // leave as is...
+// else
+// this.knownFileNames[i] = fileName.substring(matchingPathName
+// .length());
+// }
+// }
public void cleanup() {
for (int i = 0, max = this.classpaths.length; i < max; i++)
this.classpaths[i].reset();
}
- private String convertPathSeparators(String path) {
- return File.separatorChar == '/' ? path.replace('\\', '/') : path
- .replace('/', '\\');
- }
+// private String convertPathSeparators(String path) {
+// return File.separatorChar == '/' ? path.replace('\\', '/') : path
+// .replace('/', '\\');
+// }
// private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[]
// typeName){
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.util;
+package net.sourceforge.phpdt.internal.compiler.batch;
public interface SuffixConstants {
// public final static String EXTENSION_class = "class"; //$NON-NLS-1$
/**
* Add a forward refrence for the array.
*/
- void addForwardReference(int iPos) {
- int length;
- if (forwardReferenceCount >= (length = forwardReferences.length))
- System.arraycopy(forwardReferences, 0,
- (forwardReferences = new int[2 * length]), 0, length);
- forwardReferences[forwardReferenceCount++] = iPos;
- }
+// void addForwardReference(int iPos) {
+// int length;
+// if (forwardReferenceCount >= (length = forwardReferences.length))
+// System.arraycopy(forwardReferences, 0,
+// (forwardReferences = new int[2 * length]), 0, length);
+// forwardReferences[forwardReferenceCount++] = iPos;
+// }
/**
* Add a forward refrence for the array.
// }
// }
// }
- public boolean isStandardLabel() {
- return true;
- }
+// public boolean isStandardLabel() {
+// return true;
+// }
/*
* Place the label. If we have forward references resolve them.
ISourceType[] sourceTypes;
- public NameEnvironmentAnswer(IBinaryType binaryType) {
- this.binaryType = binaryType;
- }
+// public NameEnvironmentAnswer(IBinaryType binaryType) {
+// this.binaryType = binaryType;
+// }
public NameEnvironmentAnswer(ICompilationUnit compilationUnit) {
this.compilationUnit = compilationUnit;
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.flow;
-import net.sourceforge.phpdt.core.compiler.CharOperation;
+//import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
import net.sourceforge.phpdt.internal.compiler.ast.Reference;
import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+//import net.sourceforge.phpdt.internal.compiler.codegen.Label;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
this.associatedNode = associatedNode;
}
- public Label breakLabel() {
-
- return null;
- }
+// public Label breakLabel() {
+//
+// return null;
+// }
public void checkExceptionHandlers(TypeBinding[] raisedExceptions,
ASTNode location, FlowInfo flowInfo, BlockScope scope) {
scope.problemReporter().unhandledException(raisedException, location);
}
- public Label continueLabel() {
-
- return null;
- }
+// public Label continueLabel() {
+//
+// return null;
+// }
/*
* lookup through break labels
*/
- public FlowContext getTargetContextForBreakLabel(char[] labelName) {
-
- FlowContext current = this, lastNonReturningSubRoutine = null;
- while (current != null) {
- if (current.isNonReturningContext()) {
- lastNonReturningSubRoutine = current;
- }
- char[] currentLabelName;
- if (((currentLabelName = current.labelName()) != null)
- && CharOperation.equals(currentLabelName, labelName)) {
- if (lastNonReturningSubRoutine == null) {
- return current;
- } else {
- return lastNonReturningSubRoutine;
- }
- }
- current = current.parent;
- }
- // not found
- return null;
- }
+// public FlowContext getTargetContextForBreakLabel(char[] labelName) {
+//
+// FlowContext current = this, lastNonReturningSubRoutine = null;
+// while (current != null) {
+// if (current.isNonReturningContext()) {
+// lastNonReturningSubRoutine = current;
+// }
+// char[] currentLabelName;
+// if (((currentLabelName = current.labelName()) != null)
+// && CharOperation.equals(currentLabelName, labelName)) {
+// if (lastNonReturningSubRoutine == null) {
+// return current;
+// } else {
+// return lastNonReturningSubRoutine;
+// }
+// }
+// current = current.parent;
+// }
+// // not found
+// return null;
+// }
/*
* lookup through continue labels
*/
- public FlowContext getTargetContextForContinueLabel(char[] labelName) {
-
- FlowContext current = this;
- FlowContext lastContinuable = null;
- FlowContext lastNonReturningSubRoutine = null;
-
- while (current != null) {
- if (current.isNonReturningContext()) {
- lastNonReturningSubRoutine = current;
- } else {
- if (current.isContinuable()) {
- lastContinuable = current;
- }
- }
-
- char[] currentLabelName;
- if ((currentLabelName = current.labelName()) != null
- && CharOperation.equals(currentLabelName, labelName)) {
-
- // matching label found
- if ((lastContinuable != null)
- && (current.associatedNode.concreteStatement() == lastContinuable.associatedNode)) {
-
- if (lastNonReturningSubRoutine == null) {
- return lastContinuable;
- } else {
- return lastNonReturningSubRoutine;
- }
- } else {
- // label is found, but not a continuable location
- return NotContinuableContext;
- }
- }
- current = current.parent;
- }
- // not found
- return null;
- }
+// public FlowContext getTargetContextForContinueLabel(char[] labelName) {
+//
+// FlowContext current = this;
+// FlowContext lastContinuable = null;
+// FlowContext lastNonReturningSubRoutine = null;
+//
+// while (current != null) {
+// if (current.isNonReturningContext()) {
+// lastNonReturningSubRoutine = current;
+// } else {
+// if (current.isContinuable()) {
+// lastContinuable = current;
+// }
+// }
+//
+// char[] currentLabelName;
+// if ((currentLabelName = current.labelName()) != null
+// && CharOperation.equals(currentLabelName, labelName)) {
+//
+// // matching label found
+// if ((lastContinuable != null)
+// && (current.associatedNode.concreteStatement() == lastContinuable.associatedNode)) {
+//
+// if (lastNonReturningSubRoutine == null) {
+// return lastContinuable;
+// } else {
+// return lastNonReturningSubRoutine;
+// }
+// } else {
+// // label is found, but not a continuable location
+// return NotContinuableContext;
+// }
+// }
+// current = current.parent;
+// }
+// // not found
+// return null;
+// }
/*
* lookup a default break through breakable locations
*/
- public FlowContext getTargetContextForDefaultBreak() {
-
- FlowContext current = this, lastNonReturningSubRoutine = null;
- while (current != null) {
- if (current.isNonReturningContext()) {
- lastNonReturningSubRoutine = current;
- }
- if (current.isBreakable() && current.labelName() == null) {
- if (lastNonReturningSubRoutine == null) {
- return current;
- } else {
- return lastNonReturningSubRoutine;
- }
- }
- current = current.parent;
- }
- // not found
- return null;
- }
+// public FlowContext getTargetContextForDefaultBreak() {
+//
+// FlowContext current = this, lastNonReturningSubRoutine = null;
+// while (current != null) {
+// if (current.isNonReturningContext()) {
+// lastNonReturningSubRoutine = current;
+// }
+// if (current.isBreakable() && current.labelName() == null) {
+// if (lastNonReturningSubRoutine == null) {
+// return current;
+// } else {
+// return lastNonReturningSubRoutine;
+// }
+// }
+// current = current.parent;
+// }
+// // not found
+// return null;
+// }
/*
* lookup a default continue amongst continuable locations
*/
- public FlowContext getTargetContextForDefaultContinue() {
-
- FlowContext current = this, lastNonReturningSubRoutine = null;
- while (current != null) {
- if (current.isNonReturningContext()) {
- lastNonReturningSubRoutine = current;
- }
- if (current.isContinuable()) {
- if (lastNonReturningSubRoutine == null) {
- return current;
- } else {
- return lastNonReturningSubRoutine;
- }
- }
- current = current.parent;
- }
- // not found
- return null;
- }
+// public FlowContext getTargetContextForDefaultContinue() {
+//
+// FlowContext current = this, lastNonReturningSubRoutine = null;
+// while (current != null) {
+// if (current.isNonReturningContext()) {
+// lastNonReturningSubRoutine = current;
+// }
+// if (current.isContinuable()) {
+// if (lastNonReturningSubRoutine == null) {
+// return current;
+// } else {
+// return lastNonReturningSubRoutine;
+// }
+// }
+// current = current.parent;
+// }
+// // not found
+// return null;
+// }
public String individualToString() {
return "Flow context"; //$NON-NLS-1$
}
- public FlowInfo initsOnBreak() {
+// public FlowInfo initsOnBreak() {
+//
+// return FlowInfo.DEAD_END;
+// }
- return FlowInfo.DEAD_END;
- }
-
- public UnconditionalFlowInfo initsOnReturn() {
-
- return FlowInfo.DEAD_END;
- }
-
- public boolean isBreakable() {
-
- return false;
- }
+// public UnconditionalFlowInfo initsOnReturn() {
+//
+// return FlowInfo.DEAD_END;
+// }
- public boolean isContinuable() {
+// public boolean isBreakable() {
+//
+// return false;
+// }
- return false;
- }
-
- public boolean isNonReturningContext() {
+// public boolean isContinuable() {
+//
+// return false;
+// }
- return false;
- }
+// public boolean isNonReturningContext() {
+//
+// return false;
+// }
- public boolean isSubRoutine() {
-
- return false;
- }
+// public boolean isSubRoutine() {
+//
+// return false;
+// }
public char[] labelName() {
return null;
}
- public void recordBreakFrom(FlowInfo flowInfo) {
- }
+// public void recordBreakFrom(FlowInfo flowInfo) {
+// }
- public void recordContinueFrom(FlowInfo flowInfo) {
- }
+// public void recordContinueFrom(FlowInfo flowInfo) {
+// }
boolean recordFinalAssignment(VariableBinding variable,
Reference finalReference) {
return this.initsOnReturn;
}
- public boolean isNonReturningContext() {
- return associatedNode.cannotReturn();
- }
+// public boolean isNonReturningContext() {
+// return associatedNode.cannotReturn();
+// }
public ASTNode subRoutine() {
return associatedNode;
}
}
- public Label continueLabel() {
- return continueLabel;
- }
+// public Label continueLabel() {
+// return continueLabel;
+// }
public String individualToString() {
StringBuffer buffer = new StringBuffer("Looping flow context"); //$NON-NLS-1$
return buffer.toString();
}
- public boolean isContinuable() {
- return true;
- }
-
- public boolean isContinuedTo() {
- return initsOnContinue != FlowInfo.DEAD_END;
- }
-
- public void recordContinueFrom(FlowInfo flowInfo) {
-
- if (!flowInfo.isReachable())
- return;
- if (initsOnContinue == FlowInfo.DEAD_END) {
- initsOnContinue = flowInfo.copy().unconditionalInits();
- } else {
- initsOnContinue = initsOnContinue.mergedWith(flowInfo
- .unconditionalInits());
- }
- ;
- }
+// public boolean isContinuable() {
+// return true;
+// }
+
+// public boolean isContinuedTo() {
+// return initsOnContinue != FlowInfo.DEAD_END;
+// }
+
+// public void recordContinueFrom(FlowInfo flowInfo) {
+//
+// if (!flowInfo.isReachable())
+// return;
+// if (initsOnContinue == FlowInfo.DEAD_END) {
+// initsOnContinue = flowInfo.copy().unconditionalInits();
+// } else {
+// initsOnContinue = initsOnContinue.mergedWith(flowInfo
+// .unconditionalInits());
+// }
+// ;
+// }
boolean recordFinalAssignment(VariableBinding binding,
Reference finalAssignment) {
this.breakLabel = breakLabel;
}
- public Label breakLabel() {
- return breakLabel;
- }
+// public Label breakLabel() {
+// return breakLabel;
+// }
public String individualToString() {
StringBuffer buffer = new StringBuffer("Switch flow context"); //$NON-NLS-1$
return buffer.toString();
}
- public boolean isBreakable() {
- return true;
- }
-
- public void recordBreakFrom(FlowInfo flowInfo) {
-
- if (initsOnBreak == FlowInfo.DEAD_END) {
- initsOnBreak = flowInfo.copy().unconditionalInits();
- } else {
- initsOnBreak = initsOnBreak.mergedWith(flowInfo
- .unconditionalInits());
- }
- ;
- }
+// public boolean isBreakable() {
+// return true;
+// }
+
+// public void recordBreakFrom(FlowInfo flowInfo) {
+//
+// if (initsOnBreak == FlowInfo.DEAD_END) {
+// initsOnBreak = flowInfo.copy().unconditionalInits();
+// } else {
+// initsOnBreak = initsOnBreak.mergedWith(flowInfo
+// .unconditionalInits());
+// }
+// ;
+// }
}
import net.sourceforge.phpdt.internal.compiler.impl.Constant;
import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+//import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
/**
* Record initialization status during definite assignment analysis
/*
* Answer the total number of fields in enclosing types of a given type
*/
- static int numberOfEnclosingFields(ReferenceBinding type) {
-
- int count = 0;
- type = type.enclosingType();
- while (type != null) {
- count += type.fieldCount();
- type = type.enclosingType();
- }
- return count;
- }
+// static int numberOfEnclosingFields(ReferenceBinding type) {
+//
+// int count = 0;
+// type = type.enclosingType();
+// while (type != null) {
+// count += type.fieldCount();
+// type = type.enclosingType();
+// }
+// return count;
+// }
public int reachMode() {
return this.reachMode;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
+//import java.util.HashMap;
import java.util.Map;
import net.sourceforge.phpdt.core.compiler.CharOperation;
set(settings);
}
- public Map getMap() {
- Map optionsMap = new HashMap(30);
- optionsMap.put(OPTION_PHPIncludeNotExistWarning,
- getSeverityString(PHPIncludeNotExistWarning));
- optionsMap.put(OPTION_PHPVarDeprecatedWarning,
- getSeverityString(PHPVarDeprecatedWarning));
- optionsMap.put(OPTION_PHPBadStyleKeywordWarning,
- getSeverityString(PHPBadStyleKeywordWarning));
- optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning,
- getSeverityString(PHPBadStyleUppercaseIdentifierWarning));
- optionsMap.put(OPTION_UninitializedLocalVariableWarning,
- getSeverityString(UninitializedLocalVariableWarning));
- optionsMap.put(OPTION_CodeCannotBeReachedWarning,
- getSeverityString(CodeCannotBeReachedWarning));
-
- optionsMap.put(OPTION_LocalVariableAttribute,
- (this.produceDebugAttributes & Vars) != 0 ? GENERATE
- : DO_NOT_GENERATE);
- optionsMap.put(OPTION_LineNumberAttribute,
- (this.produceDebugAttributes & Lines) != 0 ? GENERATE
- : DO_NOT_GENERATE);
- optionsMap.put(OPTION_SourceFileAttribute,
- (this.produceDebugAttributes & Source) != 0 ? GENERATE
- : DO_NOT_GENERATE);
- // optionsMap.put(OPTION_PreserveUnusedLocal,
- // this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT);
- optionsMap.put(OPTION_DocCommentSupport,
- this.docCommentSupport ? ENABLED : DISABLED);
- optionsMap.put(OPTION_ReportMethodWithConstructorName,
- getSeverityString(MethodWithConstructorName));
- optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod,
- getSeverityString(OverriddenPackageDefaultMethod));
- optionsMap.put(OPTION_ReportDeprecation,
- getSeverityString(UsingDeprecatedAPI));
- optionsMap
- .put(OPTION_ReportDeprecationInDeprecatedCode,
- this.reportDeprecationInsideDeprecatedCode ? ENABLED
- : DISABLED);
- optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod,
- this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED
- : DISABLED);
- optionsMap.put(OPTION_ReportHiddenCatchBlock,
- getSeverityString(MaskedCatchBlock));
- optionsMap.put(OPTION_ReportUnusedLocal,
- getSeverityString(UnusedLocalVariable));
- optionsMap.put(OPTION_ReportUnusedParameter,
- getSeverityString(UnusedArgument));
- optionsMap.put(OPTION_ReportUnusedImport,
- getSeverityString(UnusedImport));
- optionsMap.put(OPTION_ReportSyntheticAccessEmulation,
- getSeverityString(AccessEmulation));
- optionsMap.put(OPTION_ReportNoEffectAssignment,
- getSeverityString(NoEffectAssignment));
- optionsMap.put(OPTION_ReportNonExternalizedStringLiteral,
- getSeverityString(NonExternalizedString));
- optionsMap.put(OPTION_ReportNoImplicitStringConversion,
- getSeverityString(NoImplicitStringConversion));
- optionsMap.put(OPTION_ReportNonStaticAccessToStatic,
- getSeverityString(NonStaticAccessToStatic));
- optionsMap.put(OPTION_ReportIndirectStaticAccess,
- getSeverityString(IndirectStaticAccess));
- optionsMap.put(OPTION_ReportIncompatibleNonInheritedInterfaceMethod,
- getSeverityString(IncompatibleNonInheritedInterfaceMethod));
- optionsMap.put(OPTION_ReportUnusedPrivateMember,
- getSeverityString(UnusedPrivateMember));
- optionsMap.put(OPTION_ReportLocalVariableHiding,
- getSeverityString(LocalVariableHiding));
- optionsMap
- .put(OPTION_ReportFieldHiding, getSeverityString(FieldHiding));
- optionsMap.put(OPTION_ReportPossibleAccidentalBooleanAssignment,
- getSeverityString(AccidentalBooleanAssign));
- optionsMap.put(OPTION_ReportSuperfluousSemicolon,
- getSeverityString(SuperfluousSemicolon));
- optionsMap.put(OPTION_ReportAssertIdentifier,
- getSeverityString(AssertUsedAsAnIdentifier));
- optionsMap.put(OPTION_ReportUndocumentedEmptyBlock,
- getSeverityString(UndocumentedEmptyBlock));
- optionsMap.put(OPTION_ReportUnnecessaryTypeCheck,
- getSeverityString(UnnecessaryTypeCheck));
- optionsMap.put(OPTION_ReportInvalidJavadoc,
- getSeverityString(InvalidJavadoc));
- optionsMap.put(OPTION_ReportInvalidJavadocTagsVisibility,
- getVisibilityString(this.reportInvalidJavadocTagsVisibility));
- optionsMap.put(OPTION_ReportInvalidJavadocTags,
- this.reportInvalidJavadocTags ? ENABLED : DISABLED);
- optionsMap.put(OPTION_ReportMissingJavadocTags,
- getSeverityString(MissingJavadocTags));
- optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility,
- getVisibilityString(this.reportMissingJavadocTagsVisibility));
- optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding,
- this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
- optionsMap.put(OPTION_ReportMissingJavadocComments,
- getSeverityString(MissingJavadocComments));
- optionsMap
- .put(
- OPTION_ReportMissingJavadocCommentsVisibility,
- getVisibilityString(this.reportMissingJavadocCommentsVisibility));
- optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding,
- this.reportMissingJavadocCommentsOverriding ? ENABLED
- : DISABLED);
- optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally,
- getSeverityString(FinallyBlockNotCompleting));
- optionsMap.put(OPTION_ReportUnusedDeclaredThrownException,
- getSeverityString(UnusedDeclaredThrownException));
- optionsMap
- .put(
- OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding,
- this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED
- : DISABLED);
- optionsMap.put(OPTION_ReportUnqualifiedFieldAccess,
- getSeverityString(UnqualifiedFieldAccess));
- // optionsMap.put(OPTION_Compliance,
- // versionFromJdkLevel(this.complianceLevel));
- // optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel));
- // optionsMap.put(OPTION_TargetPlatform,
- // versionFromJdkLevel(this.targetJDK));
- if (this.defaultEncoding != null) {
- optionsMap.put(OPTION_Encoding, this.defaultEncoding);
- }
- optionsMap
- .put(
- OPTION_TaskTags,
- this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$
- optionsMap
- .put(
- OPTION_TaskPriorities,
- this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites, ','))); //$NON-NLS-1$
- optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract,
- this.reportUnusedParameterWhenImplementingAbstract ? ENABLED
- : DISABLED);
- optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete,
- this.reportUnusedParameterWhenOverridingConcrete ? ENABLED
- : DISABLED);
- optionsMap.put(OPTION_ReportSpecialParameterHidingField,
- this.reportSpecialParameterHidingField ? ENABLED : DISABLED);
- optionsMap.put(OPTION_MaxProblemPerUnit, String
- .valueOf(this.maxProblemsPerUnit));
-
- return optionsMap;
- }
+// public Map getMap() {
+// Map optionsMap = new HashMap(30);
+// optionsMap.put(OPTION_PHPIncludeNotExistWarning,
+// getSeverityString(PHPIncludeNotExistWarning));
+// optionsMap.put(OPTION_PHPVarDeprecatedWarning,
+// getSeverityString(PHPVarDeprecatedWarning));
+// optionsMap.put(OPTION_PHPBadStyleKeywordWarning,
+// getSeverityString(PHPBadStyleKeywordWarning));
+// optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning,
+// getSeverityString(PHPBadStyleUppercaseIdentifierWarning));
+// optionsMap.put(OPTION_UninitializedLocalVariableWarning,
+// getSeverityString(UninitializedLocalVariableWarning));
+// optionsMap.put(OPTION_CodeCannotBeReachedWarning,
+// getSeverityString(CodeCannotBeReachedWarning));
+//
+// optionsMap.put(OPTION_LocalVariableAttribute,
+// (this.produceDebugAttributes & Vars) != 0 ? GENERATE
+// : DO_NOT_GENERATE);
+// optionsMap.put(OPTION_LineNumberAttribute,
+// (this.produceDebugAttributes & Lines) != 0 ? GENERATE
+// : DO_NOT_GENERATE);
+// optionsMap.put(OPTION_SourceFileAttribute,
+// (this.produceDebugAttributes & Source) != 0 ? GENERATE
+// : DO_NOT_GENERATE);
+// // optionsMap.put(OPTION_PreserveUnusedLocal,
+// // this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT);
+// optionsMap.put(OPTION_DocCommentSupport,
+// this.docCommentSupport ? ENABLED : DISABLED);
+// optionsMap.put(OPTION_ReportMethodWithConstructorName,
+// getSeverityString(MethodWithConstructorName));
+// optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod,
+// getSeverityString(OverriddenPackageDefaultMethod));
+// optionsMap.put(OPTION_ReportDeprecation,
+// getSeverityString(UsingDeprecatedAPI));
+// optionsMap
+// .put(OPTION_ReportDeprecationInDeprecatedCode,
+// this.reportDeprecationInsideDeprecatedCode ? ENABLED
+// : DISABLED);
+// optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod,
+// this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED
+// : DISABLED);
+// optionsMap.put(OPTION_ReportHiddenCatchBlock,
+// getSeverityString(MaskedCatchBlock));
+// optionsMap.put(OPTION_ReportUnusedLocal,
+// getSeverityString(UnusedLocalVariable));
+// optionsMap.put(OPTION_ReportUnusedParameter,
+// getSeverityString(UnusedArgument));
+// optionsMap.put(OPTION_ReportUnusedImport,
+// getSeverityString(UnusedImport));
+// optionsMap.put(OPTION_ReportSyntheticAccessEmulation,
+// getSeverityString(AccessEmulation));
+// optionsMap.put(OPTION_ReportNoEffectAssignment,
+// getSeverityString(NoEffectAssignment));
+// optionsMap.put(OPTION_ReportNonExternalizedStringLiteral,
+// getSeverityString(NonExternalizedString));
+// optionsMap.put(OPTION_ReportNoImplicitStringConversion,
+// getSeverityString(NoImplicitStringConversion));
+// optionsMap.put(OPTION_ReportNonStaticAccessToStatic,
+// getSeverityString(NonStaticAccessToStatic));
+// optionsMap.put(OPTION_ReportIndirectStaticAccess,
+// getSeverityString(IndirectStaticAccess));
+// optionsMap.put(OPTION_ReportIncompatibleNonInheritedInterfaceMethod,
+// getSeverityString(IncompatibleNonInheritedInterfaceMethod));
+// optionsMap.put(OPTION_ReportUnusedPrivateMember,
+// getSeverityString(UnusedPrivateMember));
+// optionsMap.put(OPTION_ReportLocalVariableHiding,
+// getSeverityString(LocalVariableHiding));
+// optionsMap
+// .put(OPTION_ReportFieldHiding, getSeverityString(FieldHiding));
+// optionsMap.put(OPTION_ReportPossibleAccidentalBooleanAssignment,
+// getSeverityString(AccidentalBooleanAssign));
+// optionsMap.put(OPTION_ReportSuperfluousSemicolon,
+// getSeverityString(SuperfluousSemicolon));
+// optionsMap.put(OPTION_ReportAssertIdentifier,
+// getSeverityString(AssertUsedAsAnIdentifier));
+// optionsMap.put(OPTION_ReportUndocumentedEmptyBlock,
+// getSeverityString(UndocumentedEmptyBlock));
+// optionsMap.put(OPTION_ReportUnnecessaryTypeCheck,
+// getSeverityString(UnnecessaryTypeCheck));
+// optionsMap.put(OPTION_ReportInvalidJavadoc,
+// getSeverityString(InvalidJavadoc));
+// optionsMap.put(OPTION_ReportInvalidJavadocTagsVisibility,
+// getVisibilityString(this.reportInvalidJavadocTagsVisibility));
+// optionsMap.put(OPTION_ReportInvalidJavadocTags,
+// this.reportInvalidJavadocTags ? ENABLED : DISABLED);
+// optionsMap.put(OPTION_ReportMissingJavadocTags,
+// getSeverityString(MissingJavadocTags));
+// optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility,
+// getVisibilityString(this.reportMissingJavadocTagsVisibility));
+// optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding,
+// this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
+// optionsMap.put(OPTION_ReportMissingJavadocComments,
+// getSeverityString(MissingJavadocComments));
+// optionsMap
+// .put(
+// OPTION_ReportMissingJavadocCommentsVisibility,
+// getVisibilityString(this.reportMissingJavadocCommentsVisibility));
+// optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding,
+// this.reportMissingJavadocCommentsOverriding ? ENABLED
+// : DISABLED);
+// optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally,
+// getSeverityString(FinallyBlockNotCompleting));
+// optionsMap.put(OPTION_ReportUnusedDeclaredThrownException,
+// getSeverityString(UnusedDeclaredThrownException));
+// optionsMap
+// .put(
+// OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding,
+// this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED
+// : DISABLED);
+// optionsMap.put(OPTION_ReportUnqualifiedFieldAccess,
+// getSeverityString(UnqualifiedFieldAccess));
+// // optionsMap.put(OPTION_Compliance,
+// // versionFromJdkLevel(this.complianceLevel));
+// // optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel));
+// // optionsMap.put(OPTION_TargetPlatform,
+// // versionFromJdkLevel(this.targetJDK));
+// if (this.defaultEncoding != null) {
+// optionsMap.put(OPTION_Encoding, this.defaultEncoding);
+// }
+// optionsMap
+// .put(
+// OPTION_TaskTags,
+// this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$
+// optionsMap
+// .put(
+// OPTION_TaskPriorities,
+// this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites, ','))); //$NON-NLS-1$
+// optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract,
+// this.reportUnusedParameterWhenImplementingAbstract ? ENABLED
+// : DISABLED);
+// optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete,
+// this.reportUnusedParameterWhenOverridingConcrete ? ENABLED
+// : DISABLED);
+// optionsMap.put(OPTION_ReportSpecialParameterHidingField,
+// this.reportSpecialParameterHidingField ? ENABLED : DISABLED);
+// optionsMap.put(OPTION_MaxProblemPerUnit, String
+// .valueOf(this.maxProblemsPerUnit));
+//
+// return optionsMap;
+// }
public int getSeverity(long irritant) {
if ((this.warningThreshold & irritant) != 0)
}
}
- public void setVerboseMode(boolean flag) {
- this.verbose = flag;
- }
+// public void setVerboseMode(boolean flag) {
+// this.verbose = flag;
+// }
public String toString() {
import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import net.sourceforge.phpdt.internal.compiler.util.CompoundNameVector;
+//import net.sourceforge.phpdt.internal.compiler.util.CompoundNameVector;
import net.sourceforge.phpdt.internal.compiler.util.HashtableOfObject;
import net.sourceforge.phpdt.internal.compiler.util.HashtableOfType;
import net.sourceforge.phpdt.internal.compiler.util.ObjectVector;
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.util;
+package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
char[][][] elements;
- public CompoundNameVector() {
- maxSize = INITIAL_SIZE;
- size = 0;
- elements = new char[maxSize][][];
- }
+// public CompoundNameVector() {
+// maxSize = INITIAL_SIZE;
+// size = 0;
+// elements = new char[maxSize][][];
+// }
public void add(char[][] newElement) {
if (size == maxSize) // knows that size starts <= maxSize
this.initializeScanner();
}
- public void setFileToParse(IFile fileToParse) {
- this.token = TokenNameEOF;
- this.initializeScanner();
- }
+// public void setFileToParse(IFile fileToParse) {
+// this.token = TokenNameEOF;
+// this.initializeScanner();
+// }
/**
* ClassDeclaration Constructor.
* Description of Parameter
* @see
*/
- public Parser(IFile fileToParse) {
- // if (keywordMap == null) {
- // keywordMap = new HashMap();
- // for (int i = 0; i < PHP_KEYWORS.length; i++) {
- // keywordMap.put(PHP_KEYWORS[i], new Integer(PHP_KEYWORD_TOKEN[i]));
- // }
- // }
- // this.currentPHPString = 0;
- // PHPParserSuperclass.fileToParse = fileToParse;
- // this.phpList = null;
- this.includesList = null;
- // this.str = "";
- this.token = TokenNameEOF;
- // this.chIndx = 0;
- // this.rowCount = 1;
- // this.columnCount = 0;
- // this.phpEnd = false;
- // getNextToken();
- this.initializeScanner();
- }
+// public Parser(IFile fileToParse) {
+// // if (keywordMap == null) {
+// // keywordMap = new HashMap();
+// // for (int i = 0; i < PHP_KEYWORS.length; i++) {
+// // keywordMap.put(PHP_KEYWORS[i], new Integer(PHP_KEYWORD_TOKEN[i]));
+// // }
+// // }
+// // this.currentPHPString = 0;
+// // PHPParserSuperclass.fileToParse = fileToParse;
+// // this.phpList = null;
+// this.includesList = null;
+// // this.str = "";
+// this.token = TokenNameEOF;
+// // this.chIndx = 0;
+// // this.rowCount = 1;
+// // this.columnCount = 0;
+// // this.phpEnd = false;
+// // getNextToken();
+// this.initializeScanner();
+// }
public void initializeScanner() {
this.scanner = new Scanner(
// return anomaliesDetected;
// }
// }
- protected void pushOnAstLengthStack(int pos) {
- try {
- astLengthStack[++astLengthPtr] = pos;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = astLengthStack.length;
- int[] oldPos = astLengthStack;
- astLengthStack = new int[oldStackLength + StackIncrement];
- System.arraycopy(oldPos, 0, astLengthStack, 0, oldStackLength);
- astLengthStack[astLengthPtr] = pos;
- }
- }
+// protected void pushOnAstLengthStack(int pos) {
+// try {
+// astLengthStack[++astLengthPtr] = pos;
+// } catch (IndexOutOfBoundsException e) {
+// int oldStackLength = astLengthStack.length;
+// int[] oldPos = astLengthStack;
+// astLengthStack = new int[oldStackLength + StackIncrement];
+// System.arraycopy(oldPos, 0, astLengthStack, 0, oldStackLength);
+// astLengthStack[astLengthPtr] = pos;
+// }
+// }
protected void pushOnAstStack(ASTNode node) {
/*
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import java.util.List;
-
-import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.core.IType;
-import net.sourceforge.phpdt.core.JavaCore;
-import net.sourceforge.phpdt.core.JavaModelException;
-import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
-
-import org.eclipse.core.resources.IFile;
-
-public class ParserUtil {
-
- public static SingleTypeReference getTypeReference(Scanner scanner,
- List includesList, char[] ident) {
- String identStr = new String(ident);
- ImportReference ir;
- IFile file = null;
- for (int i = 0; i < includesList.size(); i++) {
- ir = (ImportReference) includesList.get(i);
- file = ir.getFile();
- if (file != null) {
- ICompilationUnit unit = JavaCore
- .createCompilationUnitFrom(file);
- if (unit != null) {
- try {
- // TODO avoid recursion here. Sometimes we get a
- // java.lang.StackOverflowError
- IType[] types = unit.getAllTypes();
- if (types != null) {
- for (int j = 0; j < types.length; j++) {
- if (types[j].getElementName().equals(identStr)) {
- return new SingleTypeReference(
- file,
- ident,
- scanner
- .getCurrentTokenStartPosition(),
- scanner
- .getCurrentTokenEndPosition());
- }
- }
- }
- } catch (JavaModelException e) {
- e.printStackTrace();
- }
- }
- }
- }
- return null;
- }
-}
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.parser;
-import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+//import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
import net.sourceforge.phpdt.internal.compiler.ast.Block;
import net.sourceforge.phpdt.internal.compiler.ast.Statement;
protected Parser recoveringParser;
- public RecoveredElement(RecoveredElement parent, int bracketBalance) {
- this(parent, bracketBalance, null);
- }
+// public RecoveredElement(RecoveredElement parent, int bracketBalance) {
+// this(parent, bracketBalance, null);
+// }
- public RecoveredElement(RecoveredElement parent, int bracketBalance,
- Parser parser) {
- this.parent = parent;
- this.bracketBalance = bracketBalance;
- this.recoveringParser = parser;
- }
+// public RecoveredElement(RecoveredElement parent, int bracketBalance,
+// Parser parser) {
+// this.parent = parent;
+// this.bracketBalance = bracketBalance;
+// this.recoveringParser = parser;
+// }
/*
* Record a method declaration
/*
* Answer the depth of this element, considering the parent link.
*/
- public int depth() {
- int depth = 0;
- RecoveredElement current = this;
- while ((current = current.parent) != null)
- depth++;
- return depth;
- }
+// public int depth() {
+// int depth = 0;
+// RecoveredElement current = this;
+// while ((current = current.parent) != null)
+// depth++;
+// return depth;
+// }
/*
* Answer the enclosing method node, or null if none
/*
* Answer the associated parsed structure
*/
- public ASTNode parseTree() {
- return null;
- }
+// public ASTNode parseTree() {
+// return null;
+// }
/*
* Iterate the enclosing blocks and tag them so as to preserve their content
/*
* Answer the very source end of the corresponding parse node
*/
- public int sourceEnd() {
- return 0;
- }
-
- protected String tabString(int tab) {
- StringBuffer result = new StringBuffer();
- for (int i = tab; i > 0; i--) {
- result.append(" "); //$NON-NLS-1$
- }
- return result.toString();
- }
+// public int sourceEnd() {
+// return 0;
+// }
+
+// protected String tabString(int tab) {
+// StringBuffer result = new StringBuffer();
+// for (int i = tab; i > 0; i--) {
+// result.append(" "); //$NON-NLS-1$
+// }
+// return result.toString();
+// }
/*
* Answer the top node
* Update the corresponding parse node from parser state which is about to
* disappear because of restarting recovery
*/
- public void updateFromParserState() {
- }
+// public void updateFromParserState() {
+// }
/*
* A closing brace got consumed, might have closed the current element, in
* which case both the currentElement is exited
*/
- public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd) {
- if ((--bracketBalance <= 0) && (parent != null)) {
- this.updateSourceEndIfNecessary(braceEnd);
- return parent;
- }
- return this;
- }
+// public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd) {
+// if ((--bracketBalance <= 0) && (parent != null)) {
+// this.updateSourceEndIfNecessary(braceEnd);
+// return parent;
+// }
+// return this;
+// }
/*
* An opening brace got consumed, might be the expected opening one of the
* current element, in which case the bodyStart is updated.
*/
- public RecoveredElement updateOnOpeningBrace(int braceEnd) {
-
- if (bracketBalance++ == 0) {
- this.updateBodyStart(braceEnd + 1);
- return this;
- }
- return null; // no update is necessary
- }
+// public RecoveredElement updateOnOpeningBrace(int braceEnd) {
+//
+// if (bracketBalance++ == 0) {
+// this.updateBodyStart(braceEnd + 1);
+// return this;
+// }
+// return null; // no update is necessary
+// }
/*
* Final update the corresponding parse node
*/
- public void updateParseTree() {
- }
+// public void updateParseTree() {
+// }
/*
* Update the declarationSourceEnd of the corresponding parse node
// <= 0xFF);
}
- public static boolean isSQLIdentifierPart(char ch) {
- if (ch < MAX_OBVIOUS) {
- return ObviousIdentCharNatures[ch] == C_LETTER
- || ObviousIdentCharNatures[ch] == C_DIGIT;
- }
- return false;
- }
+// public static boolean isSQLIdentifierPart(char ch) {
+// if (ch < MAX_OBVIOUS) {
+// return ObviousIdentCharNatures[ch] == C_LETTER
+// || ObviousIdentCharNatures[ch] == C_DIGIT;
+// }
+// return false;
+// }
public final boolean atEnd() {
// This code is not relevant if source is
return true;
}
- public final char[] getRawTokenSourceEnd() {
- int length = this.eofPosition - this.currentPosition - 1;
- char[] sourceEnd = new char[length];
- System.arraycopy(this.source, this.currentPosition, sourceEnd, 0,
- length);
- return sourceEnd;
- }
+// public final char[] getRawTokenSourceEnd() {
+// int length = this.eofPosition - this.currentPosition - 1;
+// char[] sourceEnd = new char[length];
+// System.arraycopy(this.source, this.currentPosition, sourceEnd, 0,
+// length);
+// return sourceEnd;
+// }
public int getCurrentTokenStartPosition() {
return this.startPosition;
}
- public final String getCurrentStringLiteral() {
- char[] result = getCurrentStringLiteralSource();
- return new String(result);
- }
+// public final String getCurrentStringLiteral() {
+// char[] result = getCurrentStringLiteralSource();
+// return new String(result);
+// }
public final char[] getCurrentStringLiteralSource() {
// Return the token REAL source (aka unicodes are precomputed)
return result;
}
- public final char[] getCurrentStringLiteralSource(int startPos) {
- // Return the token REAL source (aka unicodes are precomputed)
- char[] result;
- int length;
- System.arraycopy(source, startPos + 1,
- result = new char[length = currentPosition - startPos - 2], 0,
- length);
- // }
- return result;
- }
+// public final char[] getCurrentStringLiteralSource(int startPos) {
+// // Return the token REAL source (aka unicodes are precomputed)
+// char[] result;
+// int length;
+// System.arraycopy(source, startPos + 1,
+// result = new char[length = currentPosition - startPos - 2], 0,
+// length);
+// // }
+// return result;
+// }
/*
* Search the source position corresponding to the end of a given line
*/
public class SyntaxError extends Error {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8723926000065578914L;
+
/** The line where the error start */
int lineNumber;
*
* @return the line number
*/
- public int getLine() {
- return lineNumber;
- }
+// public int getLine() {
+// return lineNumber;
+// }
}
package net.sourceforge.phpdt.internal.compiler.parser;
-import net.sourceforge.phpdt.core.IJavaModelMarker;
-import net.sourceforge.phpdt.core.compiler.IProblem;
+//import net.sourceforge.phpdt.core.IJavaModelMarker;
+//import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+//import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
+//import org.eclipse.core.resources.IMarker;
+//import org.eclipse.core.resources.IResource;
+//import org.eclipse.core.runtime.CoreException;
/**
*
* problem's range - it has an extra attribute "ID" which holds the
* problem's id
*/
- protected void storeProblemsFor(IResource resource, IProblem[] problems)
- throws CoreException {
- if (resource == null || problems == null || problems.length == 0)
- return;
-
- for (int i = 0, l = problems.length; i < l; i++) {
- IProblem problem = problems[i];
- int id = problem.getID();
- if (id != IProblem.Task) {
- IMarker marker = resource
- .createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
- marker
- .setAttributes(
- new String[] { IMarker.MESSAGE,
- IMarker.SEVERITY, IJavaModelMarker.ID,
- IMarker.CHAR_START, IMarker.CHAR_END,
- IMarker.LINE_NUMBER,
- IJavaModelMarker.ARGUMENTS },
- new Object[] {
- problem.getMessage(),
- new Integer(
- problem.isError() ? IMarker.SEVERITY_ERROR
- : IMarker.SEVERITY_WARNING),
- new Integer(id),
- new Integer(problem.getSourceStart()),
- new Integer(problem.getSourceEnd() + 1),
- new Integer(problem
- .getSourceLineNumber()),
- net.sourceforge.phpdt.internal.core.util.Util
- .getProblemArgumentsForMarker(problem
- .getArguments()) });
- }
-
- }
- }
+// protected void storeProblemsFor(IResource resource, IProblem[] problems)
+// throws CoreException {
+// if (resource == null || problems == null || problems.length == 0)
+// return;
+//
+// for (int i = 0, l = problems.length; i < l; i++) {
+// IProblem problem = problems[i];
+// int id = problem.getID();
+// if (id != IProblem.Task) {
+// IMarker marker = resource
+// .createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
+// marker
+// .setAttributes(
+// new String[] { IMarker.MESSAGE,
+// IMarker.SEVERITY, IJavaModelMarker.ID,
+// IMarker.CHAR_START, IMarker.CHAR_END,
+// IMarker.LINE_NUMBER,
+// IJavaModelMarker.ARGUMENTS },
+// new Object[] {
+// problem.getMessage(),
+// new Integer(
+// problem.isError() ? IMarker.SEVERITY_ERROR
+// : IMarker.SEVERITY_WARNING),
+// new Integer(id),
+// new Integer(problem.getSourceStart()),
+// new Integer(problem.getSourceEnd() + 1),
+// new Integer(problem
+// .getSourceLineNumber()),
+// net.sourceforge.phpdt.internal.core.util.Util
+// .getProblemArgumentsForMarker(problem
+// .getArguments()) });
+// }
+//
+// }
+// }
// A P I
// A P I
- public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit,
- CompilationResult compilationResult, int start, int end) {
- // parses a compilation unit and manages error handling (even bugs....)
-
- CompilationUnitDeclaration unit;
- try {
- /* automaton initialization */
- initialize(false);
- goForCompilationUnit();
-
- /* scanner initialization */
- scanner.setSource(sourceUnit, sourceUnit.getContents());
- scanner.resetTo(start, end);
- /* unit creation */
- referenceContext = compilationUnit = new CompilationUnitDeclaration(
- problemReporter, compilationResult, scanner.source.length);
-
- /* run automaton */
- parse();
- } catch (SyntaxError syntaxError) {
- //
- } finally {
- unit = compilationUnit;
- compilationUnit = null; // reset parser
- }
- return unit;
- }
+// public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit,
+// CompilationResult compilationResult, int start, int end) {
+// // parses a compilation unit and manages error handling (even bugs....)
+//
+// CompilationUnitDeclaration unit;
+// try {
+// /* automaton initialization */
+// initialize(false);
+// goForCompilationUnit();
+//
+// /* scanner initialization */
+// scanner.setSource(sourceUnit, sourceUnit.getContents());
+// scanner.resetTo(start, end);
+// /* unit creation */
+// referenceContext = compilationUnit = new CompilationUnitDeclaration(
+// problemReporter, compilationResult, scanner.source.length);
+//
+// /* run automaton */
+// parse();
+// } catch (SyntaxError syntaxError) {
+// //
+// } finally {
+// unit = compilationUnit;
+// compilationUnit = null; // reset parser
+// }
+// return unit;
+// }
public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit,
CompilationResult compilationResult) {
return parsedUnit;
}
- public void getMethodBodies(CompilationUnitDeclaration unit) {
- // fill the methods bodies in order for the code to be generated
-
- if (unit == null)
- return;
-
- if (unit.ignoreMethodBodies) {
- unit.ignoreFurtherInvestigation = true;
- return;
- // if initial diet parse did not work, no need to dig into method
- // bodies.
- }
-
- if ((unit.bits & ASTNode.HasAllMethodBodies) != 0)
- return; // work already done ...
-
- // real parse of the method....
- char[] contents = unit.compilationResult.compilationUnit.getContents();
- this.scanner.setSource(contents);
-
- // save existing values to restore them at the end of the parsing
- // process
- // see bug 47079 for more details
- int[] oldLineEnds = this.scanner.lineEnds;
- int oldLinePtr = this.scanner.linePtr;
-
- final int[] lineSeparatorPositions = unit.compilationResult.lineSeparatorPositions;
- this.scanner.lineEnds = lineSeparatorPositions;
- this.scanner.linePtr = lineSeparatorPositions.length - 1;
-
- // if (this.javadocParser != null && this.javadocParser.checkDocComment)
- // {
- // this.javadocParser.scanner.setSource(contents);
- // }
- if (unit.types != null) {
- for (int i = unit.types.size(); --i >= 0;)
- ((TypeDeclaration) unit.types.get(i)).parseMethod(this, unit);
- }
-
- // tag unit has having read bodies
- unit.bits |= ASTNode.HasAllMethodBodies;
-
- // this is done to prevent any side effects on the compilation unit
- // result
- // line separator positions array.
- this.scanner.lineEnds = oldLineEnds;
- this.scanner.linePtr = oldLinePtr;
- }
+// public void getMethodBodies(CompilationUnitDeclaration unit) {
+// // fill the methods bodies in order for the code to be generated
+//
+// if (unit == null)
+// return;
+//
+// if (unit.ignoreMethodBodies) {
+// unit.ignoreFurtherInvestigation = true;
+// return;
+// // if initial diet parse did not work, no need to dig into method
+// // bodies.
+// }
+//
+// if ((unit.bits & ASTNode.HasAllMethodBodies) != 0)
+// return; // work already done ...
+//
+// // real parse of the method....
+// char[] contents = unit.compilationResult.compilationUnit.getContents();
+// this.scanner.setSource(contents);
+//
+// // save existing values to restore them at the end of the parsing
+// // process
+// // see bug 47079 for more details
+// int[] oldLineEnds = this.scanner.lineEnds;
+// int oldLinePtr = this.scanner.linePtr;
+//
+// final int[] lineSeparatorPositions = unit.compilationResult.lineSeparatorPositions;
+// this.scanner.lineEnds = lineSeparatorPositions;
+// this.scanner.linePtr = lineSeparatorPositions.length - 1;
+//
+// // if (this.javadocParser != null && this.javadocParser.checkDocComment)
+// // {
+// // this.javadocParser.scanner.setSource(contents);
+// // }
+// if (unit.types != null) {
+// for (int i = unit.types.size(); --i >= 0;)
+// ((TypeDeclaration) unit.types.get(i)).parseMethod(this, unit);
+// }
+//
+// // tag unit has having read bodies
+// unit.bits |= ASTNode.HasAllMethodBodies;
+//
+// // this is done to prevent any side effects on the compilation unit
+// // result
+// // line separator positions array.
+// this.scanner.lineEnds = oldLineEnds;
+// this.scanner.linePtr = oldLinePtr;
+// }
}
*/
public class AbortCompilation extends RuntimeException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3674083924553307963L;
+
public CompilationResult compilationResult;
public Throwable exception;
* should only be thrown from within problem handlers.
*/
public class AbortCompilationUnit extends AbortCompilation {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3222208987438059121L;
+
public AbortCompilationUnit(CompilationResult compilationResult) {
super(compilationResult);
}
* should only be thrown from within problem handlers.
*/
public class AbortMethod extends AbortType {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4628813219671313506L;
+
public AbortMethod(CompilationResult compilationResult) {
super(compilationResult);
}
* should only be thrown from within problem handlers.
*/
public class AbortType extends AbortCompilationUnit {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -874610762828349876L;
+
public AbortType(CompilationResult compilationResult) {
super(compilationResult);
}
package net.sourceforge.phpdt.internal.compiler.problem;
import net.sourceforge.phpdt.core.compiler.IProblem;
-import net.sourceforge.phpdt.internal.compiler.util.Util;
+//import net.sourceforge.phpdt.internal.compiler.util.Util;
public class DefaultProblem implements ProblemSeverities, IProblem {
private char[] fileName;
this.line = line;
}
- public String errorReportSource(char[] unitSource) {
- // extra from the source the innacurate token
- // and "highlight" it using some underneath ^^^^^
- // put some context around too.
- // this code assumes that the font used in the console is fixed size
- // sanity .....
- if ((startPosition > endPosition)
- || ((startPosition < 0) && (endPosition < 0)))
- return Util.bind("problem.noSourceInformation"); //$NON-NLS-1$
- StringBuffer errorBuffer = new StringBuffer(" "); //$NON-NLS-1$
- errorBuffer.append(Util.bind("problem.atLine", String.valueOf(line))); //$NON-NLS-1$
- errorBuffer.append("\n\t"); //$NON-NLS-1$
- char c;
- final char SPACE = '\u0020';
- final char MARK = '^';
- final char TAB = '\t';
- // the next code tries to underline the token.....
- // it assumes (for a good display) that token source does not
- // contain any \r \n. This is false on statements !
- // (the code still works but the display is not optimal !)
- // expand to line limits
- int length = unitSource.length, begin, end;
- for (begin = startPosition >= length ? length - 1 : startPosition; begin > 0; begin--) {
- if ((c = unitSource[begin - 1]) == '\n' || c == '\r')
- break;
- }
- for (end = endPosition >= length ? length - 1 : endPosition; end + 1 < length; end++) {
- if ((c = unitSource[end + 1]) == '\r' || c == '\n')
- break;
- }
- // trim left and right spaces/tabs
- while ((c = unitSource[begin]) == ' ' || c == '\t')
- begin++;
- // while ((c = unitSource[end]) == ' ' || c == '\t') end--; TODO
- // (philippe) should also trim right, but all tests are to be updated
- // copy source
- errorBuffer.append(unitSource, begin, end - begin + 1);
- errorBuffer.append("\n\t"); //$NON-NLS-1$
- // compute underline
- for (int i = begin; i < startPosition; i++) {
- errorBuffer.append((unitSource[i] == TAB) ? TAB : SPACE);
- }
- for (int i = startPosition; i <= (endPosition >= length ? length - 1
- : endPosition); i++) {
- errorBuffer.append(MARK);
- }
- return errorBuffer.toString();
- }
+// public String errorReportSource(char[] unitSource) {
+// // extra from the source the innacurate token
+// // and "highlight" it using some underneath ^^^^^
+// // put some context around too.
+// // this code assumes that the font used in the console is fixed size
+// // sanity .....
+// if ((startPosition > endPosition)
+// || ((startPosition < 0) && (endPosition < 0)))
+// return Util.bind("problem.noSourceInformation"); //$NON-NLS-1$
+// StringBuffer errorBuffer = new StringBuffer(" "); //$NON-NLS-1$
+// errorBuffer.append(Util.bind("problem.atLine", String.valueOf(line))); //$NON-NLS-1$
+// errorBuffer.append("\n\t"); //$NON-NLS-1$
+// char c;
+// final char SPACE = '\u0020';
+// final char MARK = '^';
+// final char TAB = '\t';
+// // the next code tries to underline the token.....
+// // it assumes (for a good display) that token source does not
+// // contain any \r \n. This is false on statements !
+// // (the code still works but the display is not optimal !)
+// // expand to line limits
+// int length = unitSource.length, begin, end;
+// for (begin = startPosition >= length ? length - 1 : startPosition; begin > 0; begin--) {
+// if ((c = unitSource[begin - 1]) == '\n' || c == '\r')
+// break;
+// }
+// for (end = endPosition >= length ? length - 1 : endPosition; end + 1 < length; end++) {
+// if ((c = unitSource[end + 1]) == '\r' || c == '\n')
+// break;
+// }
+// // trim left and right spaces/tabs
+// while ((c = unitSource[begin]) == ' ' || c == '\t')
+// begin++;
+// // while ((c = unitSource[end]) == ' ' || c == '\t') end--; TODO
+// // (philippe) should also trim right, but all tests are to be updated
+// // copy source
+// errorBuffer.append(unitSource, begin, end - begin + 1);
+// errorBuffer.append("\n\t"); //$NON-NLS-1$
+// // compute underline
+// for (int i = begin; i < startPosition; i++) {
+// errorBuffer.append((unitSource[i] == TAB) ? TAB : SPACE);
+// }
+// for (int i = startPosition; i <= (endPosition >= length ? length - 1
+// : endPosition); i++) {
+// errorBuffer.append(MARK);
+// }
+// return errorBuffer.toString();
+// }
// public String errorReportSource(ITextEditor textEditor){
// //ICompilationUnit compilationUnit) {
* net.sourceforge.phpdt.internal.compiler.IProblem
* @return String
*/
- public final String localizedMessage(IProblem problem) {
- return getLocalizedMessage(problem.getID(), problem.getArguments());
- }
+// public final String localizedMessage(IProblem problem) {
+// return getLocalizedMessage(problem.getID(), problem.getArguments());
+// }
/**
* This method initializes the MessageTemplates class variable according to
compilationResult);
}
- public void phpParsingWarning(String[] messageArguments,
- int problemStartPosition, int problemEndPosition,
- ReferenceContext context, CompilationResult compilationResult) {
- this.handle(IProblem.PHPParsingWarning, NoArgument, messageArguments,
- problemStartPosition, problemEndPosition, context,
- compilationResult);
- }
+// public void phpParsingWarning(String[] messageArguments,
+// int problemStartPosition, int problemEndPosition,
+// ReferenceContext context, CompilationResult compilationResult) {
+// this.handle(IProblem.PHPParsingWarning, NoArgument, messageArguments,
+// problemStartPosition, problemEndPosition, context,
+// compilationResult);
+// }
public void phpVarDeprecatedWarning(int problemStartPosition,
int problemEndPosition, ReferenceContext context,
* (internal only)
*/
public class ShouldNotImplement extends RuntimeException {
- public ShouldNotImplement() {
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 599981042161407964L;
+
+// public ShouldNotImplement() {
+// }
public ShouldNotImplement(String message) {
super(message);
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.util;
-
-/**
- * Hashtable for non-zero int keys.
- */
-
-public final class HashtableOfInt {
- // to avoid using Enumerations, walk the individual tables skipping nulls
- public int[] keyTable;
-
- public Object[] valueTable;
-
- int elementSize; // number of elements in the table
-
- int threshold;
-
- public HashtableOfInt() {
- this(13);
- }
-
- public HashtableOfInt(int size) {
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of
- // elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new int[extraRoom];
- this.valueTable = new Object[extraRoom];
- }
-
- public boolean containsKey(int key) {
- int index = key % valueTable.length;
- int currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return true;
- index = (index + 1) % keyTable.length;
- }
- return false;
- }
-
- public Object get(int key) {
- int index = key % valueTable.length;
- int currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return valueTable[index];
- index = (index + 1) % keyTable.length;
- }
- return null;
- }
-
- public Object put(int key, Object value) {
- int index = key % valueTable.length;
- int currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return valueTable[index] = value;
- index = (index + 1) % keyTable.length;
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
- }
-
- private void rehash() {
- HashtableOfInt newHashtable = new HashtableOfInt(elementSize * 2); // double
- // the
- // number
- // of
- // expected
- // elements
- int currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != 0)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- Object object;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((object = valueTable[i]) != null)
- s += keyTable[i] + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.util;
-
-import net.sourceforge.phpdt.core.compiler.CharOperation;
-
-/**
- * Hashtable of {char[] --> int}
- */
-public final class HashtableOfIntValues implements Cloneable {
-
- public static final int NO_VALUE = Integer.MIN_VALUE;
-
- // to avoid using Enumerations, walk the individual tables skipping nulls
- public char[] keyTable[];
-
- public int valueTable[];
-
- public int elementSize; // number of elements in the table
-
- int threshold;
-
- public HashtableOfIntValues() {
- this(13);
- }
-
- public HashtableOfIntValues(int size) {
-
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of
- // elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new char[extraRoom][];
- this.valueTable = new int[extraRoom];
- }
-
- public Object clone() throws CloneNotSupportedException {
- HashtableOfIntValues result = (HashtableOfIntValues) super.clone();
- result.elementSize = this.elementSize;
- result.threshold = this.threshold;
-
- int length = this.keyTable.length;
- result.keyTable = new char[length][];
- System.arraycopy(this.keyTable, 0, result.keyTable, 0, length);
-
- length = this.valueTable.length;
- result.valueTable = new int[length];
- System.arraycopy(this.valueTable, 0, result.valueTable, 0, length);
- return result;
- }
-
- public boolean containsKey(char[] key) {
-
- int index = CharOperation.hashCode(key) % valueTable.length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength
- && CharOperation.equals(currentKey, key))
- return true;
- index = (index + 1) % keyTable.length;
- }
- return false;
- }
-
- public int get(char[] key) {
-
- int index = CharOperation.hashCode(key) % valueTable.length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength
- && CharOperation.equals(currentKey, key))
- return valueTable[index];
- index = (index + 1) % keyTable.length;
- }
- return NO_VALUE;
- }
-
- public int put(char[] key, int value) {
-
- int index = CharOperation.hashCode(key) % valueTable.length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength
- && CharOperation.equals(currentKey, key))
- return valueTable[index] = value;
- index = (index + 1) % keyTable.length;
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
- }
-
- public int removeKey(char[] key) {
-
- int index = CharOperation.hashCode(key) % valueTable.length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength
- && CharOperation.equals(currentKey, key)) {
- int value = valueTable[index];
- elementSize--;
- keyTable[index] = null;
- valueTable[index] = NO_VALUE;
- rehash();
- return value;
- }
- index = (index + 1) % keyTable.length;
- }
- return NO_VALUE;
- }
-
- private void rehash() {
-
- HashtableOfIntValues newHashtable = new HashtableOfIntValues(
- elementSize * 2); // double the number of expected elements
- char[] currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != null)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- char[] key;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((key = keyTable[i]) != null)
- s += new String(key) + " -> " + valueTable[i] + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.util;
-
-/**
- * Hashtable for non-zero long keys.
- */
-
-public final class HashtableOfLong {
- // to avoid using Enumerations, walk the individual tables skipping nulls
- public long[] keyTable;
-
- public Object[] valueTable;
-
- int elementSize; // number of elements in the table
-
- int threshold;
-
- public HashtableOfLong() {
- this(13);
- }
-
- public HashtableOfLong(int size) {
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of
- // elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new long[extraRoom];
- this.valueTable = new Object[extraRoom];
- }
-
- public boolean containsKey(long key) {
- int index = ((int) (key >>> 32)) % valueTable.length;
- long currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return true;
- index = (index + 1) % keyTable.length;
- }
- return false;
- }
-
- public Object get(long key) {
- int index = ((int) (key >>> 32)) % valueTable.length;
- long currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return valueTable[index];
- index = (index + 1) % keyTable.length;
- }
- return null;
- }
-
- public Object put(long key, Object value) {
- int index = ((int) (key >>> 32)) % valueTable.length;
- long currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return valueTable[index] = value;
- index = (index + 1) % keyTable.length;
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
- }
-
- private void rehash() {
- HashtableOfLong newHashtable = new HashtableOfLong(elementSize * 2); // double
- // the
- // number
- // of
- // expected
- // elements
- long currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != 0)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- Object object;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((object = valueTable[i]) != null)
- s += keyTable[i] + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-}