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() {
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:
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();
}
} 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 :