From: khartlage Date: Mon, 19 Jul 2004 20:10:59 +0000 (+0000) Subject: fix "stack trace" from this post: http://phpeclipse.de/tiki-view_forum_thread.php ? X-Git-Url: http://git.phpeclipse.com fix "stack trace" from this post: phpeclipse.de/tiki-view_forum_thread.php ? --- 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 e7491b1..f668f45 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 @@ -923,6 +923,8 @@ public class Parser //extends PHPParserSuperclass } else if (token == TokenNamefinal || token == TokenNameabstract || token == TokenNameclass || token == TokenNameinterface) { TypeDeclaration typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult); typeDecl.declarationSourceStart = scanner.getCurrentTokenStartPosition(); + typeDecl.declarationSourceEnd = scanner.getCurrentTokenEndPosition(); + typeDecl.name = new char[]{' '}; // default super class typeDecl.superclass = new SingleTypeReference(TypeConstants.OBJECT, 0); compilationUnit.types.add(typeDecl); @@ -1093,19 +1095,19 @@ public class Parser //extends PHPParserSuperclass checkAndSetModifiers(AccInterface); getNextToken(); typeDecl.modifiers = this.modifiers; + typeDecl.sourceStart = scanner.getCurrentTokenStartPosition(); + typeDecl.sourceEnd = scanner.getCurrentTokenEndPosition(); if (token == TokenNameIdentifier || token > TokenNameKEYWORD) { - typeDecl.sourceStart = scanner.getCurrentTokenStartPosition(); - typeDecl.sourceEnd = scanner.getCurrentTokenEndPosition(); typeDecl.name = scanner.getCurrentIdentifierSource(); if (token > TokenNameKEYWORD) { - throwSyntaxError("Don't use a keyword for interface declaration [" + scanner.toStringAction(token) + "].", - typeDecl.sourceStart, typeDecl.sourceEnd); + problemReporter.phpKeywordWarning(new String[]{scanner.toStringAction(token)}, scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition(), + referenceContext, compilationUnit.compilationResult); +// throwSyntaxError("Don't use a keyword for interface declaration [" + scanner.toStringAction(token) + "].", +// typeDecl.sourceStart, typeDecl.sourceEnd); } getNextToken(); interface_extends_list(); } else { - typeDecl.sourceStart = scanner.getCurrentTokenStartPosition(); - typeDecl.sourceEnd = scanner.getCurrentTokenEndPosition(); typeDecl.name = new char[]{' '}; throwSyntaxError("Interface name expected after keyword 'interface'.", typeDecl.sourceStart, typeDecl.sourceEnd); return; @@ -1116,15 +1118,17 @@ public class Parser //extends PHPParserSuperclass // '{' class_statement_list'}' class_entry_type(); typeDecl.modifiers = this.modifiers; + typeDecl.sourceStart = scanner.getCurrentTokenStartPosition(); + typeDecl.sourceEnd = scanner.getCurrentTokenEndPosition(); //identifier //identifier 'extends' identifier if (token == TokenNameIdentifier || token > TokenNameKEYWORD) { - typeDecl.sourceStart = scanner.getCurrentTokenStartPosition(); - typeDecl.sourceEnd = scanner.getCurrentTokenEndPosition(); typeDecl.name = scanner.getCurrentIdentifierSource(); if (token > TokenNameKEYWORD) { - throwSyntaxError("Don't use a keyword for class declaration [" + scanner.toStringAction(token) + "].", - typeDecl.sourceStart, typeDecl.sourceEnd); + problemReporter.phpKeywordWarning(new String[]{scanner.toStringAction(token)}, scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition(), + referenceContext, compilationUnit.compilationResult); +// throwSyntaxError("Don't use a keyword for class declaration [" + scanner.toStringAction(token) + "].", +// typeDecl.sourceStart, typeDecl.sourceEnd); } getNextToken(); // extends_from: @@ -1142,8 +1146,6 @@ public class Parser //extends PHPParserSuperclass } implements_list(); } else { - typeDecl.sourceStart = scanner.getCurrentTokenStartPosition(); - typeDecl.sourceEnd = scanner.getCurrentTokenEndPosition(); typeDecl.name = new char[]{' '}; throwSyntaxError("Class name expected after keyword 'class'.", typeDecl.sourceStart, typeDecl.sourceEnd); return;