fix for http://sourceforge.net/tracker/index.php?func=detail&aid=1413064&group_id...
authorbananeweizen <bananeweizen>
Mon, 23 Jan 2006 19:04:11 +0000 (19:04 +0000)
committerbananeweizen <bananeweizen>
Mon, 23 Jan 2006 19:04:11 +0000 (19:04 +0000)
parser did not recognize nested braces in string literals

net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java

index d049c52..9782a3e 100644 (file)
@@ -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();