コード例 #1
0
 private string Dump(LeafRule.ExpandRule leafRule)
 {
     if (leafRule == null)
     {
         return(null);
     }
     return(string.Format("NonTerminal('{0} = {1}')", leafRule.Expand, leafRule.Short));
 }
コード例 #2
0
 public void TestExpandRule()
 {
     var rule = new LeafRule.ExpandRule("short7", "expand");
     Assert.AreEqual(rule.Match("short7ending").Short, "short7");
     Assert.AreEqual(rule.Match("short7ending").Expand, "expand");
     Assert.AreEqual(rule.Match("short7").Short, "short7");
     Assert.AreEqual(rule.Match("short7short7").Short, "short7");
     Assert.IsFalse(rule.Match("wr").Success);
 }
コード例 #3
0
        public void TestExpandRule()
        {
            var rule = new LeafRule.ExpandRule("short7", "expand");

            Assert.AreEqual(rule.Match("short7ending").Short, "short7");
            Assert.AreEqual(rule.Match("short7ending").Expand, "expand");
            Assert.AreEqual(rule.Match("short7").Short, "short7");
            Assert.AreEqual(rule.Match("short7short7").Short, "short7");
            Assert.IsFalse(rule.Match("wr").Success);
        }