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 44568b9..e3d3672 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 @@ -152,7 +152,7 @@ public class Parser extends PHPParserSuperclass implements ITerminalSymbols { this.initializeScanner(); } /** - * Class Constructor. + * ClassDeclaration Constructor. * *@param s *@param sess Description of Parameter @@ -1418,7 +1418,7 @@ public class Parser extends PHPParserSuperclass implements ITerminalSymbols { private void parseDeclarations( PHPOutlineInfo outlineInfo, - PHPSegmentWithChildren current, + OutlineableWithChildren current, boolean goBack) { char[] ident; // PHPClassDeclaration current = (PHPClassDeclaration) stack.peek(); @@ -1437,7 +1437,8 @@ public class Parser extends PHPParserSuperclass implements ITerminalSymbols { if (token == TokenNameVariable && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_VAR)) { ident = scanner.getCurrentIdentifierSource(); - String variableName = new String(ident); + //substring(1) added because PHPVarDeclaration doesn't need the $ anymore + String variableName = new String(ident).substring(1); outlineInfo.addVariable(variableName); getNextToken(); if (token != TokenNameSEMICOLON) { @@ -1975,11 +1976,15 @@ public class Parser extends PHPParserSuperclass implements ITerminalSymbols { if (token == TokenNameIdentifier) { getNextToken(); } else { - throwSyntaxError("Class name expected after keyword 'extends'."); + throwSyntaxError("ClassDeclaration name expected after keyword 'extends'."); } } } else { - throwSyntaxError("Class name expected after keyword 'class'."); + if (token > TokenNameKEYWORD) { + throwSyntaxError( + "Don't use keyword for class declaration [" + token + "]."); + } + throwSyntaxError("ClassDeclaration name expected after keyword 'class'."); } } @@ -2070,6 +2075,12 @@ public class Parser extends PHPParserSuperclass implements ITerminalSymbols { } else { getNextToken(); } + } else { + if (token > TokenNameKEYWORD) { + throwSyntaxError( + "Don't use keyword for function declaration [" + token + "]."); + } + throwSyntaxError("Function name expected after keyword 'function'."); } } //