From: khartlage Date: Fri, 5 Mar 2004 17:09:38 +0000 (+0000) Subject: misc parser changes X-Git-Url: http://secure.phpeclipse.com misc parser changes --- 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 271c3d6..7369a24 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 @@ -1410,10 +1410,10 @@ public class Parser //extends PHPParserSuperclass typeDecl.declarationSourceEnd = scanner.getCurrentTokenEndPosition(); getNextToken(); } else { - throwSyntaxError("'}' expected at end of interface body."); + throwSyntaxError("'}' expected at end of class body."); } } else { - throwSyntaxError("'{' expected at start of interface body."); + throwSyntaxError("'{' expected at start of class body."); } } private void class_entry_type() { @@ -1492,7 +1492,14 @@ public class Parser //extends PHPParserSuperclass private void class_statement_list() { do { class_statement(); - } while (token == TokenNamefunction || token == TokenNamevar); + } while (token == TokenNamepublic || + token == TokenNameprotected || + token == TokenNameprivate || + token == TokenNamestatic || + token == TokenNameabstract || + token == TokenNamefinal || + token == TokenNamefunction || + token == TokenNamevar); } private void class_statement() { // class_statement: @@ -2185,6 +2192,26 @@ public class Parser //extends PHPParserSuperclass getNextToken(); } break; + case TokenNamearray : + // T_ARRAY '(' array_pair_list ')' + getNextToken(); + if (token == TokenNameLPAREN) { + getNextToken(); + if (token == TokenNameRPAREN) { + getNextToken(); + break; + } + array_pair_list(); + if (token != TokenNameRPAREN) { + throwSyntaxError("')' expected after keyword 'array'" + + "(Found token: " + scanner.toStringAction(token) + ")"); + } + getNextToken(); + } else { + throwSyntaxError("'(' expected after keyword 'array'" + + "(Found token: " + scanner.toStringAction(token) + ")"); + } + break; case TokenNameprint : getNextToken(); expr(); @@ -2358,6 +2385,29 @@ public class Parser //extends PHPParserSuperclass } } while (while_flag); } + private void array_pair_list() { +// array_pair_list: +// /* empty */ +//| non_empty_array_pair_list possible_comma + non_empty_array_pair_list(); + if (token == TokenNameCOMMA) { + getNextToken(); + } + } + + + private void non_empty_array_pair_list() { +//non_empty_array_pair_list: +// non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr +//| non_empty_array_pair_list ',' expr +//| expr T_DOUBLE_ARROW expr +//| expr +//| non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable +//| non_empty_array_pair_list ',' '&' w_variable +//| expr T_DOUBLE_ARROW '&' w_variable +//| '&' w_variable + } + private void unaryExpression() { switch (token) { case TokenNamePLUS_PLUS : 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 83ca372..a9520dd 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 @@ -160,7 +160,7 @@ public class Scanner implements IScanner, ITerminalSymbols { public char[][] taskTags = null; public char[][] taskPriorities = null; - public static final boolean DEBUG = false; + public static final boolean DEBUG = true; public Scanner() { this(false, false);