import java.util.HashMap;
import java.util.HashSet;
+import net.sourceforge.phpdt.core.ICompilationUnit;
+import net.sourceforge.phpdt.core.IJavaElement;
+import net.sourceforge.phpdt.core.IType;
+import net.sourceforge.phpdt.core.JavaCore;
+import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
// | T_EXTENDS interface_list
if (token == TokenNameextends) {
getNextToken();
- interface_list();
+ class_list(typeDecl);
}
}
// | T_IMPLEMENTS interface_list
if (token == TokenNameimplements) {
getNextToken();
- interface_list();
+ interface_list(typeDecl);
}
}
- private void interface_list() {
+ private void class_list(TypeDeclaration typeDecl) {
+ // class_list:
+ // fully_qualified_class_name
+ do {
+ if (token == TokenNameIdentifier) {
+ char[] ident = scanner.getCurrentIdentifierSource();
+ // TODO make this code working better:
+ // SingleTypeReference ref = ParserUtil.getTypeReference(scanner,
+ // includesList, ident);
+ // if (ref != null) {
+ // typeDecl.superclass = ref;
+ // }
+ getNextToken();
+ } else {
+ throwSyntaxError("Classname expected after keyword 'extends'.");
+ }
+ if (token == TokenNameCOMMA) {
+ reportSyntaxError("No multiple inheritence allowed. Expected token 'implements' or '{'.");
+ getNextToken();
+ continue;
+ } else {
+ break;
+ }
+ } while (true);
+ }
+
+ private void interface_list(TypeDeclaration typeDecl) {
// interface_list:
// fully_qualified_class_name
// | interface_list ',' fully_qualified_class_name
if (token == TokenNameIdentifier) {
getNextToken();
} else {
- throwSyntaxError("Interface name expected after keyword 'implements'.");
+ throwSyntaxError("Interfacename expected after keyword 'implements'.");
}
if (token != TokenNameCOMMA) {
return;
String ext = file.getRawLocation().getFileExtension();
int fileExtensionLength = ext == null ? 0 : ext.length() + 1;
+ IFile f = PHPFileUtil.createFile(path, project);
+
impt.tokens = CharOperation.splitOn('/', filePath.toCharArray(), 0, filePath.length() - fileExtensionLength);
- impt.setFile(PHPFileUtil.createFile(path, project));
+ impt.setFile(f);
} catch (Exception e) {
// the file is outside of the workspace
}