public void TestLiveTemplateMatcherTests() { var concatRule = new ConcatRule(new LeafRule[] { new LeafRule.ExpandRule("some", "Expand"), new LeafRule.ExpandRule("2", "2") }.NToList()); var concatRuleAlt = new ConcatRule(new LeafRule[] { new LeafRule.ExpandRule("some", "Expand3"), new LeafRule.ExpandRule("3", "3") }.NToList()); var mresult = MatcherFromRule(StartRule(concatRule, concatRuleAlt)).Match("some3", Scopename); Assert.IsFalse(mresult.Success); Assert.IsTrue(string.IsNullOrEmpty(mresult.Tail)); }
private string DumpConcatRule(ConcatRule concatRule) { var listlr = new List <string>(); foreach (var leafRule in concatRule.Rules) { var item = Dump(leafRule as LeafRule.String) ?? Dump(leafRule as LeafRule.Substitution) ?? Dump(leafRule as LeafRule.ExpandRule) ?? Dump(leafRule as LeafRule.InsideRule) ?? Dump(leafRule as LeafRule.NonTerminal); if (item != null) { listlr.Add(item); } } return(string.Format("Sequence({0})", string.Join(",", listlr))); }
private string DumpConcatRule(ConcatRule concatRule) { var listlr = new List<string>(); foreach (var leafRule in concatRule.Rules) { var item = Dump(leafRule as LeafRule.String) ?? Dump(leafRule as LeafRule.Substitution) ?? Dump(leafRule as LeafRule.ExpandRule) ?? Dump(leafRule as LeafRule.InsideRule) ?? Dump(leafRule as LeafRule.NonTerminal); if (item != null) listlr.Add(item); } return string.Format("Sequence({0})", string.Join(",", listlr)); }