Пример #1
0
 public override void doRow(Parse row)
 {
     hasExecuted = false;
     try {
         reset();
         base.doRow(row);
         if (!hasExecuted) {
             execute();
         }
     }
     catch (Exception e) {
         exception(row.leaf(), e);
     }
 }
Пример #2
0
 public override void doRows(Parse rows)
 {
     try {
         bind(rows.parts);
         results = query();
         match(list(rows.more), list(results), 0);
         Parse last = rows.last();
         last.more = buildRows(surplus.ToArray());
         mark(last.more, "surplus");
         mark(missing, "missing");
     }
     catch (Exception e) {
         exception(rows.leaf(), e);
     }
 }
Пример #3
0
 public override void doRow(Parse row)
 {
     hasExecuted = false;
     try {
         reset();
         base.doRow(row);
         if (!hasExecuted)
         {
             execute();
         }
     }
     catch (Exception e) {
         exception(row.leaf(), e);
     }
 }
Пример #4
0
 public override void doRows(Parse rows)
 {
     try {
         bind(rows.parts);
         results = query();
         match(list(rows.more), list(results), 0);
         Parse last = rows.last();
         last.more = buildRows(surplus.ToArray());
         mark(last.more, "surplus");
         mark(missing, "missing");
     }
     catch (Exception e) {
         exception (rows.leaf(), e);
     }
 }
Пример #5
0
 public void testIndexing()
 {
     Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr><tr><td>four</td></tr></table>trailer");
     Assert.AreEqual("one", p.at(0,0,0).body);
     Assert.AreEqual("two", p.at(0,0,1).body);
     Assert.AreEqual("three", p.at(0,0,2).body);
     Assert.AreEqual("three", p.at(0,0,3).body);
     Assert.AreEqual("three", p.at(0,0,4).body);
     Assert.AreEqual("four", p.at(0,1,0).body);
     Assert.AreEqual("four", p.at(0,1,1).body);
     Assert.AreEqual("four", p.at(0,2,0).body);
     Assert.AreEqual(1, p.size());
     Assert.AreEqual(2, p.parts.size());
     Assert.AreEqual(3, p.parts.parts.size());
     Assert.AreEqual("one", p.leaf().body);
     Assert.AreEqual("four", p.parts.last().leaf().body);
 }
Пример #6
0
        public void testIndexing()
        {
            Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr><tr><td>four</td></tr></table>trailer");

            Assert.AreEqual("one", p.at(0, 0, 0).body);
            Assert.AreEqual("two", p.at(0, 0, 1).body);
            Assert.AreEqual("three", p.at(0, 0, 2).body);
            Assert.AreEqual("three", p.at(0, 0, 3).body);
            Assert.AreEqual("three", p.at(0, 0, 4).body);
            Assert.AreEqual("four", p.at(0, 1, 0).body);
            Assert.AreEqual("four", p.at(0, 1, 1).body);
            Assert.AreEqual("four", p.at(0, 2, 0).body);
            Assert.AreEqual(1, p.size());
            Assert.AreEqual(2, p.parts.size());
            Assert.AreEqual(3, p.parts.parts.size());
            Assert.AreEqual("one", p.leaf().body);
            Assert.AreEqual("four", p.parts.last().leaf().body);
        }
Пример #7
0
 public virtual Parse leaf()
 {
     return(parts == null ? this : parts.leaf());
 }