/***********************************************************************************************************************************
- * Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material are
- * made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material 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: www.phpeclipse.de
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
public class Parser //extends PHPParserSuperclass
implements ITerminalSymbols, CompilerModifiers, ParserBasicInformation {
//internal data for the automat
protected final static int StackIncrement = 255;
-
+
protected int stateStackTop;
protected int[] stack = new int[StackIncrement];
public void initializeScanner() {
this.scanner = new Scanner(false /* comment */, false /* whitespace */, this.options
.getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore /* nls */, false, false,
- this.options.taskTags/* taskTags */, this.options.taskPriorites/* taskPriorities */);
+ this.options.taskTags/* taskTags */,
+ this.options.taskPriorites/* taskPriorities */,
+ true/*isTaskCaseSensitive*/);
}
/**
throw new SyntaxError(1, 0, " ", error);
}
+ private void reportSyntaxError(String error) {
+ int problemStartPosition = scanner.getCurrentTokenStartPosition();
+ int problemEndPosition = scanner.getCurrentTokenEndPosition();
+ reportSyntaxError(error, problemStartPosition, problemEndPosition + 1);
+ }
+
private void reportSyntaxError(String error, int problemStartPosition, int problemEndPosition) {
problemReporter.phpParsingError(new String[] { error }, problemStartPosition, problemEndPosition, referenceContext,
compilationUnit.compilationResult);
// typeDecl.sourceStart, typeDecl.sourceEnd);
}
getNextToken();
- interface_extends_list();
+ interface_extends_list(typeDecl);
} else {
typeDecl.name = new char[] { ' ' };
throwSyntaxError("Interface name expected after keyword 'interface'.", typeDecl.sourceStart, typeDecl.sourceEnd);
// /* empty */
// | T_EXTENDS fully_qualified_class_name
if (token == TokenNameextends) {
- interface_extends_list();
+ interface_extends_list(typeDecl);
// getNextToken();
// if (token != TokenNameIdentifier) {
// throwSyntaxError("Class name expected after keyword
// .getCurrentTokenEndPosition());
// }
}
- implements_list();
+ implements_list(typeDecl);
} else {
typeDecl.name = new char[] { ' ' };
throwSyntaxError("Class name expected after keyword 'class'.", typeDecl.sourceStart, typeDecl.sourceEnd);
}
}
- private void interface_extends_list() {
+ private void class_extends(TypeDeclaration typeDecl) {
+ // /* empty */
+ // | T_EXTENDS interface_list
+ if (token == TokenNameextends) {
+ getNextToken();
+
+ if (token == TokenNameIdentifier) {
+ getNextToken();
+ } else {
+ throwSyntaxError("Class name expected after keyword 'extends'.");
+ }
+ }
+ }
+
+ private void interface_extends_list(TypeDeclaration typeDecl) {
// /* empty */
// | T_EXTENDS interface_list
if (token == TokenNameextends) {
}
}
- private void implements_list() {
+ private void implements_list(TypeDeclaration typeDecl) {
// /* empty */
// | T_IMPLEMENTS interface_list
if (token == TokenNameimplements) {
- getNextToken();
+ getNextToken();
interface_list();
}
}
}
} else { // TokenNamedefault
getNextToken();
- if (token == TokenNameCOLON) {
+ if (token == TokenNameCOLON || token == TokenNameSEMICOLON) {
getNextToken();
if (token == TokenNameRBRACE) {
// empty default case
// System.out.println(new String(compilationUnit.getFileName())+" - "+ expression.toStringExpression());
IProject project = resource.getProject();
if (project != null) {
- if (PHPFileUtil.determineFilePath(includeNameString, resource, project) == null) {
- reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: "
- + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd);
- // System.out.println(path.toString() + " - " + expression.toStringExpression());
+ IPath path = PHPFileUtil.determineFilePath(includeNameString, resource, project);
+
+ if (path == null) {
+ // reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: "
+ // + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd);
+ String[] args = { expression.toStringExpression(), project.getLocation().toString() };
+ problemReporter.phpIncludeNotExistWarning(args, literal.sourceStart, literal.sourceEnd, referenceContext,
+ compilationUnit.compilationResult);
+ } else {
+ impt.setFile( PHPFileUtil.createFile(path, project) );
}
}
}