X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index d82979c..024d093 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -1275,7 +1275,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI // | T_EXTENDS interface_list if (token == TokenNameextends) { getNextToken(); - interface_list(); + class_list(typeDecl); } } @@ -1284,11 +1284,37 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI // | 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 @@ -1296,7 +1322,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI if (token == TokenNameIdentifier) { getNextToken(); } else { - throwSyntaxError("Interface name expected after keyword 'implements'."); + throwSyntaxError("Interfacename expected after keyword 'implements'."); } if (token != TokenNameCOMMA) { return; @@ -2867,6 +2893,8 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI variable(true, false); } else if (token == TokenNameDOLLAR) { variable(false, false); + } else if (token == TokenNameIdentifier) { + identifier(true, true); } else { if (token == TokenNamelist) { getNextToken(); @@ -3888,8 +3916,10 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI 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 }