private void statementList() throws CoreException {
do {
- statement();
+ statement(TokenNameEOF);
if ((token == TokenNameRBRACE)
|| (token == TokenNamecase)
|| (token == TokenNamedefault)
}
}
- private void statement() throws CoreException {
+ private void statement(int previousToken) throws CoreException {
// if (token > TokenNameKEYWORD && token != TokenNamelist && token != TokenNamenew) {
// char[] ident = scanner.getCurrentIdentifierSource();
// String keyword = new String(ident);
if (token == TokenNameinclude || token == TokenNameinclude_once) {
getNextToken();
- expression();
- if (token == TokenNameSEMICOLON) {
- getNextToken();
- } else {
- if (token != TokenNameStopPHP) {
- throwSyntaxError("';' character after 'include' or 'include_once' expected.");
+ if (token == TokenNameLPAREN) {
+ expression();
+ if (token == TokenNameSEMICOLON) {
+ getNextToken();
+ } else {
+ if (previousToken != TokenNameAT && token != TokenNameStopPHP) {
+ throwSyntaxError("';' expected after 'include' or 'include_once'.");
+ }
+ // getNextToken();
}
- getNextToken();
+ } else {
+ concatenationExpression();
}
+
return;
} else if (token == TokenNamerequire || token == TokenNamerequire_once) {
getNextToken();
//constant();
- expression();
- if (token == TokenNameSEMICOLON) {
- getNextToken();
- } else {
- if (token != TokenNameStopPHP) {
- throwSyntaxError("';' character after 'require' or 'require_once' expected.");
+ if (token == TokenNameLPAREN) {
+ expression();
+ if (token == TokenNameSEMICOLON) {
+ getNextToken();
+ } else {
+ if (previousToken != TokenNameAT && token != TokenNameStopPHP) {
+ throwSyntaxError("';' expected after 'require' or 'require_once'.");
+ }
+ // getNextToken();
}
- getNextToken();
+ } else {
+ concatenationExpression();
}
return;
} else if (token == TokenNameif) {
getNextToken();
} else {
// statement [else-statement]
- statement();
+ statement(TokenNameEOF);
if (token == TokenNameelseif) {
getNextToken();
if (token == TokenNameLPAREN) {
ifStatement();
} else if (token == TokenNameelse) {
getNextToken();
- statement();
+ statement(TokenNameEOF);
}
}
}
}
getNextToken();
} else {
- statement();
+ statement(TokenNameEOF);
}
}
}
getNextToken();
} else {
- statement();
+ statement(TokenNameEOF);
}
}
}
getNextToken();
} else {
- statement();
+ statement(TokenNameEOF);
}
}
// String ident;
char[] ident;
boolean castFlag = false;
+ boolean arrayFlag = false;
switch (token) {
case TokenNamenew :
getNextToken();
break;
case TokenNameLPAREN :
getNextToken();
+
if (token == TokenNameIdentifier) {
// check if identifier is a type:
// ident = identifier;
for (int i = 0; i < PHP_TYPES.length; i++) {
if (PHP_TYPES[i].equals(str)) {
castFlag = true;
+ if (PHP_TYPES[i].equals("array")) {
+ arrayFlag = true;
+ }
break;
}
}
- if (castFlag) {
+ }
+
+ if (castFlag) {
+ getNextToken();
+ if (arrayFlag && token == TokenNameLPAREN) {
getNextToken();
- if (token != TokenNameRPAREN) {
- throwSyntaxError(") expected after cast-type '" + str + "'.");
+ if (token == TokenNameRPAREN) {
+ getNextToken();
+ } else {
+ expression();
+ if (token != TokenNameRPAREN) {
+ throwSyntaxError(") expected after 'array('.");
+ }
}
- getNextToken();
- expression();
- break;
}
- }
- if (!castFlag) {
+ if (token != TokenNameRPAREN) {
+ throwSyntaxError(") expected after cast-type '" + str + "'.");
+ }
+ getNextToken();
+ expression();
+ break;
+ } else {
expression();
}
if (token != TokenNameRPAREN) {
|| token == TokenNameinclude_once
|| token == TokenNamerequire
|| token == TokenNamerequire_once) {
- statement();
+ statement(TokenNameAT);
} else {
postfixExpression(); // castExpression();
}