X-Git-Url: http://git.phpeclipse.com 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 41a9404..1bc55b9 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 @@ -21,7 +21,7 @@ import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities; 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; @@ -1440,7 +1440,7 @@ public class Parser //extends PHPParserSuperclass 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) { @@ -2943,16 +2943,9 @@ public class Parser //extends PHPParserSuperclass 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 == '$') { @@ -3053,7 +3046,9 @@ public class Parser //extends PHPParserSuperclass break; case TokenNameDOLLAR_LBRACE : getNextToken(); - if (token == TokenNameIdentifier) { + if (token == TokenNameDOLLAR_LBRACE) { + encaps_var(); + } else if (token == TokenNameIdentifier) { getNextToken(); if (token == TokenNameLBRACKET) { getNextToken(); @@ -3067,23 +3062,19 @@ public class Parser //extends PHPParserSuperclass 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(); @@ -3092,7 +3083,7 @@ public class Parser //extends PHPParserSuperclass // } else { expr(); if (token != TokenNameRBRACKET) { - throwSyntaxError("']' expected after '{$'."); + throwSyntaxError("']' expected."); } getNextToken(); // } @@ -3103,6 +3094,18 @@ public class Parser //extends PHPParserSuperclass 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 '{$'."); @@ -3545,10 +3548,10 @@ public class Parser //extends PHPParserSuperclass //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() */ @@ -3975,7 +3978,7 @@ public class Parser //extends PHPParserSuperclass astLengthStack[astLengthPtr] = pos; } } - protected void pushOnAstStack(AstNode node) { + protected void pushOnAstStack(ASTNode node) { /* * add a new obj on top of the ast stack */ @@ -3983,8 +3986,8 @@ public class Parser //extends PHPParserSuperclass 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;