import net.sourceforge.phpdt.internal.compiler.util.Util;
import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AstNode;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
if (astPtr == 0) {
compilationUnit.types.add(methodDecl);
} else {
- AstNode node = astStack[astPtr];
+ ASTNode node = astStack[astPtr];
if (node instanceof TypeDeclaration) {
TypeDeclaration typeDecl = ((TypeDeclaration) node);
if (typeDecl.methods == null) {
//| static_member '(' function_call_parameter_list ')'
//| variable_without_objects '(' function_call_parameter_list ')'
char[] defineName = null;
+ char[] ident = null;
int startPos=0;
int endPos=0;
if (Scanner.TRACE) {
System.out.println("TRACE: function_call()");
}
if (token == TokenNameIdentifier) {
- defineName = scanner.getCurrentIdentifierSource();
+ ident = scanner.getCurrentIdentifierSource();
+ defineName = ident;
startPos = scanner.getCurrentTokenStartPosition();
endPos = scanner.getCurrentTokenEndPosition();
getNextToken();
}
non_empty_function_call_parameter_list();
if (token != TokenNameRPAREN) {
- throwSyntaxError("')' expected in function call.");
+ String functionName;
+ if (ident==null) {
+ functionName = new String(" ");
+ } else {
+ functionName = new String(ident);
+ }
+ throwSyntaxError("')' expected in function call ("+functionName+").");
}
getNextToken();
}
break;
case TokenNameVariable :
case TokenNameDOLLAR_LBRACE :
- case TokenNameCURLY_OPEN :
+ case TokenNameLBRACE_DOLLAR :
encaps_var();
break;
- // case TokenNameDOLLAR :
- // getNextToken();
- // if (token == TokenNameLBRACE) {
- // token = TokenNameDOLLAR_LBRACE;
- // encaps_var();
- // }
- // break;
default :
char encapsedChar = ((Character) scanner.encapsedStringStack.peek()).charValue();
if (encapsedChar == '$') {
break;
case TokenNameDOLLAR_LBRACE :
getNextToken();
- if (token == TokenNameIdentifier) {
+ if (token == TokenNameDOLLAR_LBRACE) {
+ encaps_var();
+ } else if (token == TokenNameIdentifier) {
getNextToken();
if (token == TokenNameLBRACKET) {
getNextToken();
getNextToken();
// }
}
- if (token != TokenNameRBRACE) {
- throwSyntaxError("'}' expected after '${'.");
- }
- // scanner.encapsedStringStack.pop();
- getNextToken();
} else {
expr();
- if (token != TokenNameRBRACE) {
- throwSyntaxError("'}' expected.");
- }
- // scanner.encapsedStringStack.pop();
- getNextToken();
}
+ if (token != TokenNameRBRACE) {
+ throwSyntaxError("'}' expected.");
+ }
+ getNextToken();
break;
- case TokenNameCURLY_OPEN :
+ case TokenNameLBRACE_DOLLAR :
getNextToken();
- if (token == TokenNameIdentifier || token > TokenNameKEYWORD) {
+ if (token == TokenNameLBRACE_DOLLAR) {
+ encaps_var();
+ } else if (token == TokenNameIdentifier || token > TokenNameKEYWORD) {
getNextToken();
if (token == TokenNameLBRACKET) {
getNextToken();
// } else {
expr();
if (token != TokenNameRBRACKET) {
- throwSyntaxError("']' expected after '{$'.");
+ throwSyntaxError("']' expected.");
}
getNextToken();
// }
} else if (token == TokenNameMINUS_GREATER) {
getNextToken();
- if (token != TokenNameIdentifier) {
- throwSyntaxError("String token expected.");
+ if (token != TokenNameIdentifier &&
+ token != TokenNameVariable) {
+ throwSyntaxError("String or Variable token expected.");
}
getNextToken();
+ if (token == TokenNameLBRACKET) {
+ getNextToken();
+ // if (token == TokenNameRBRACKET) {
+ // getNextToken();
+ // } else {
+ expr();
+ if (token != TokenNameRBRACKET) {
+ throwSyntaxError("']' expected after '${'.");
+ }
+ getNextToken();
+ // }
+ }
}
// if (token != TokenNameRBRACE) {
// throwSyntaxError("'}' expected after '{$'.");
//ast stack
final static int AstStackIncrement = 100;
protected int astPtr;
- protected AstNode[] astStack = new AstNode[AstStackIncrement];
+ protected ASTNode[] astStack = new ASTNode[AstStackIncrement];
protected int astLengthPtr;
protected int[] astLengthStack;
- AstNode[] noAstNodes = new AstNode[AstStackIncrement];
+ ASTNode[] noAstNodes = new ASTNode[AstStackIncrement];
public CompilationUnitDeclaration compilationUnit; /*
* the result from parse()
*/
astLengthStack[astLengthPtr] = pos;
}
}
- protected void pushOnAstStack(AstNode node) {
+ protected void pushOnAstStack(ASTNode node) {
/*
* add a new obj on top of the ast stack
*/
astStack[++astPtr] = node;
} catch (IndexOutOfBoundsException e) {
int oldStackLength = astStack.length;
- AstNode[] oldStack = astStack;
- astStack = new AstNode[oldStackLength + AstStackIncrement];
+ ASTNode[] oldStack = astStack;
+ astStack = new ASTNode[oldStackLength + AstStackIncrement];
System.arraycopy(oldStack, 0, astStack, 0, oldStackLength);
astPtr = oldStackLength;
astStack[astPtr] = node;