Exemplo n.º 1
0
 public void ChompBalancedMatchesAsMuchAsPossible()
 {
     TokenQueue tq = new TokenQueue("unbalanced(something(or another");
     tq.ConsumeTo("(");
     string match = tq.ChompBalanced('(', ')');
     Assert.AreEqual("something(or another", match);
 }
Exemplo n.º 2
0
        public void ChompBalanced()
        {
            TokenQueue tq = new TokenQueue(":contains(one (two) three) four");
            string pre = tq.ConsumeTo("(");
            string guts = tq.ChompBalanced('(', ')');
            string remainder = tq.Remainder();

            Assert.AreEqual(":contains", pre);
            Assert.AreEqual("one (two) three", guts);
            Assert.AreEqual(" four", remainder);
        }