[xbuild] Parsing conditions with property references. Fixes #20634
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / ConditionTokenizer.cs
index 29a4aba628af1765cad1851993be5fe6e4ec9d73..d9ee74475d6b79c919c3f660c01c180806a96bdd 100644 (file)
@@ -257,6 +257,29 @@ namespace Microsoft.Build.BuildEngine {
                        } else
                                throw new ExpressionParseException (String.Format ("Invalid token: {0}", ch));
                }
+
+               public void ScanForClosingParens (int parensCounter = 1)
+               {
+                       tokenPosition = position;
+                       int start = position;
+                       int ch;
+                       while ((ch = ReadChar ()) >= 0) {
+                               switch (ch) {
+                               case ')':
+                                       if (--parensCounter == 0) {
+                                               --position;
+                                               token = new Token (inputString.Substring (start, position - start), TokenType.String, tokenPosition);
+                                               return;
+                                       }
+                                       break;
+                               case '(':
+                                       ++parensCounter;
+                                       break;
+                               }
+                       }
+
+                       token = new Token (null, TokenType.EOF, tokenPosition);
+               }
                
                public int TokenPosition {
                        get { return tokenPosition; }