From de54b270ec794e2563fa81ad55b68e72b5b02acc Mon Sep 17 00:00:00 2001 From: khartlage Date: Wed, 2 Apr 2003 20:47:20 +0000 Subject: [PATCH 1/1] added new error messages for keywords function, class --- .../phpdt/internal/compiler/parser/Parser.java | 10 ++++++++++ .../phpdt/internal/compiler/parser/Scanner.java | 1 + 2 files changed, 11 insertions(+), 0 deletions(-) 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..7b63621 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 @@ -1979,6 +1979,10 @@ public class Parser extends PHPParserSuperclass implements ITerminalSymbols { } } } else { + if (token > TokenNameKEYWORD) { + throwSyntaxError( + "Don't use keyword for class declaration [" + token + "]."); + } throwSyntaxError("Class name expected after keyword 'class'."); } } @@ -2070,6 +2074,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'."); } } // diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index 5427ff6..ac3546e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -158,6 +158,7 @@ public class Scanner implements IScanner, ITerminalSymbols { public static final int BracketKinds = 3; public static final boolean DEBUG = false; + public Scanner() { this(false, false); } -- 1.7.1