case RETURN:
expression = null;
getNextToken();
+/*
+ if (token == TokenName.VARIABLE) {
+ getNextToken ();
+
+ if (token == TokenName.PAAMAYIM_NEKUDOTAYIM) {
+ getNextToken ();
+
+ if (token != TokenName.IDENTIFIER) {
+ throwSyntaxError("identifier expected after '::'.");
+ }
+ else {
+ getNextToken ();
+ }
+ }
+ }
+*/
if (token != TokenName.SEMICOLON) {
expression = expr();
}
+
if (token == TokenName.SEMICOLON) {
sourceEnd = scanner.getCurrentTokenEndPosition();
getNextToken();
- } else {
+ }
+ else {
if (token != TokenName.INLINE_HTML) {
throwSyntaxError("';' expected after 'return'.");
}
+
sourceEnd = scanner.getCurrentTokenEndPosition();
getNextToken();
}
case CLASS:
case INTERFACE:
try {
- TypeDeclaration typeDecl = new TypeDeclaration(
- this.compilationUnit.compilationResult);
- typeDecl.declarationSourceStart = scanner
- .getCurrentTokenStartPosition();
- typeDecl.declarationSourceEnd = scanner
- .getCurrentTokenEndPosition();
+ TypeDeclaration typeDecl = new TypeDeclaration (this.compilationUnit.compilationResult);
+ typeDecl.declarationSourceStart = scanner.getCurrentTokenStartPosition();
+ typeDecl.declarationSourceEnd = scanner.getCurrentTokenEndPosition();
typeDecl.name = new char[] { ' ' };
// default super class
- typeDecl.superclass = new SingleTypeReference(
- TypeConstants.OBJECT, 0);
+ typeDecl.superclass = new SingleTypeReference(TypeConstants.OBJECT, 0);
compilationUnit.types.add(typeDecl);
pushOnAstStack(typeDecl);
unticked_class_declaration_statement(typeDecl);
astLengthPtr--;
}
return statement;
+
case LBRACE:
getNextToken();
if (token != TokenName.RBRACE) {
}
else {
if (token == TokenName.RBRACE) {
- reportSyntaxError("';' expected after expression (Found token: "
+ reportSyntaxError ("';' expected after expression (Found token: "
+ scanner.toStringAction(token) + ")");
}
else {
- if (token != TokenName.INLINE_HTML && token != TokenName.EOF) {
- throwSyntaxError("';' expected after expression (Found token: "
+ if (token == TokenName.PAAMAYIM_NEKUDOTAYIM) {
+ getNextToken ();
+
+ if (token != TokenName.IDENTIFIER) {
+ throwSyntaxError("identifier expected after '::'.");
+ }
+ else {
+ getNextToken ();
+ }
+ }
+ else if (token != TokenName.INLINE_HTML && token != TokenName.EOF) {
+ throwSyntaxError ("';' expected after expression (Found token: "
+ scanner.toStringAction(token) + ")");
}
getNextToken();
if (token == TokenName.OP_AND) {
getNextToken();
}
-
+
methodDecl.sourceStart = scanner.getCurrentTokenStartPosition();
methodDecl.sourceEnd = scanner.getCurrentTokenEndPosition();
-
+
if (Scanner.isIdentifierOrKeyword (token) ||
token == TokenName.LPAREN) {
-
+
if (token == TokenName.LPAREN) {
methodDecl.selector = scanner.getCurrentIdentifierSource();
-
+
if (token.compareTo (TokenName.KEYWORD) > 0) {
problemReporter.phpKeywordWarning (new String[] {scanner.toStringAction(token) },
scanner.getCurrentTokenStartPosition(),
}
else {
methodDecl.selector = scanner.getCurrentIdentifierSource();
-
+
if (token.compareTo (TokenName.KEYWORD) > 0) {
problemReporter.phpKeywordWarning (new String[] {scanner.toStringAction(token) },
scanner.getCurrentTokenStartPosition(),
referenceContext,
compilationUnit.compilationResult);
}
-
+
getNextToken();
}
-
+
if (token == TokenName.LPAREN) {
getNextToken();
}
methodDecl.sourceEnd = scanner.getCurrentTokenStartPosition() - 1;
throwSyntaxError("'(' expected in function declaration.");
}
-
+
if (token != TokenName.RPAREN) {
parameter_list(methodDecl);
}
-
+
if (token != TokenName.RPAREN) {
methodDecl.sourceEnd = scanner.getCurrentTokenStartPosition() - 1;
throwSyntaxError("')' expected in function declaration.");
- }
+ }
else {
methodDecl.bodyStart = scanner.getCurrentTokenEndPosition() + 1;
getNextToken();
* @param only_variable
* @param initHandler
*/
- private Expression expr_without_variable (boolean only_variable,
+ private Expression expr_without_variable (boolean only_variable,
UninitializedVariableHandler initHandler,
boolean bColonAllowed) {
int exprSourceStart = scanner.getCurrentTokenStartPosition();
if (token == TokenName.IDENTIFIER) {
lhs = identifier(true, true, bColonAllowed);
+
if (lhs != null) {
expression = lhs;
}
- } else {
- lhs = variable(true, true);
+ }
+ else {
+ lhs = variable (true, true);
if (lhs != null) {
expression = lhs;
}
} else {
Expression rhs = expr_without_variable (only_variable, initHandler, bColonAllowed);
-
+
if (lhs != null && lhs instanceof FieldReference) {
if (rhs != null && rhs instanceof FieldReference) {
// example:
case INSTANCEOF:
getNextToken();
TypeReference classRef = class_name_reference();
-
+
if (classRef != null) {
expression = new InstanceOfExpression (expression, classRef, OperatorIds.INSTANCEOF);
expression.sourceStart = exprSourceStart;
method_or_not();
variable_properties();
}
+ else if (token == TokenName.PAAMAYIM_NEKUDOTAYIM) {
+ ref = null;
+ getNextToken();
+ object_property();
+ method_or_not();
+ variable_properties();
+ }
+
return ref;
}
method_or_not();
variable_properties();
}
-
+
// A colon is only allowed here if it is an expression read after a '?'
-
+
if ((token == TokenName.COLON) &&
(!bColonAllowed)) {
throwSyntaxError ("No ':' allowed");