From: bananeweizen Date: Mon, 23 Jan 2006 19:04:11 +0000 (+0000) Subject: fix for http://sourceforge.net/tracker/index.php?func=detail&aid=1413064&group_id... X-Git-Url: http://secure.phpeclipse.com fix for sourceforge.net/tracker/index.php?func=detail&aid=1413064&group_id=57621&atid=484801 parser did not recognize nested braces in string literals --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index d049c52..9782a3e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -1216,11 +1216,11 @@ public class Scanner implements IScanner, ITerminalSymbols { public void consumeStringLiteral() throws InvalidInputException { try { - boolean openDollarBrace = false; + int openDollarBrace = 0; // consume next character unicodeAsBackSlash = false; currentCharacter = source[currentPosition++]; - while (currentCharacter != '"' || openDollarBrace) { + while (currentCharacter != '"' || openDollarBrace>0) { /** ** in PHP \r and \n are valid in string literals *** */ if (currentCharacter == '\\') { int escapeSize = currentPosition; @@ -1242,11 +1242,11 @@ public class Scanner implements IScanner, ITerminalSymbols { } } } else if (currentCharacter == '$' && source[currentPosition] == '{') { - openDollarBrace = true; + openDollarBrace++; } else if (currentCharacter == '{' && source[currentPosition] == '$') { - openDollarBrace = true; + openDollarBrace++; } else if (currentCharacter == '}') { - openDollarBrace = false; + openDollarBrace--; } else if ((currentCharacter == '\r') || (currentCharacter == '\n')) { if (recordLineSeparator) { pushLineSeparator();