public void TestGrammarWithConflicts2_CanParseField() { var grammar = new ConflictResolutionTestGrammar2(); var parser = new Parser(grammar); var sample = FieldSample; var tree = parser.Parse(sample); Assert.IsNotNull(tree); Assert.IsFalse(tree.HasErrors()); Assert.IsNotNull(tree.Root); var term = tree.Root.Term as NonTerminal; Assert.IsNotNull(term); Assert.AreEqual("definition", term.Name); Assert.AreEqual(1, tree.Root.ChildNodes.Count); var nodes = tree.Root.ChildNodes.Select(t => t.FirstChild).ToArray(); Assert.AreEqual("fieldModifier", nodes[0].Term.Name); }
public void TestGrammarWithConflicts2_DoesntHaveErrors() { var grammar = new ConflictResolutionTestGrammar2(); var parser = new Parser(grammar); Assert.IsTrue(parser.Language.Errors.Count == 0); }