public void ParseInvalidEarlyTerminatingString() { NonTerminal S, T, F; LR0 parser = new SLR1(LR0Test.ConstructTestGrammar(out S, out T, out F)); parser.Parse("((x)*t)*"); }
public void ParseInvalidUnexpectedCharacterString() { NonTerminal S, T, F; LR0 parser = new SLR1(LR0Test.ConstructTestGrammar(out S, out T, out F)); parser.Parse("((x)*t)**"); }
public void ParseValidString() { NonTerminal S, T, F; LRParserBase parser = new SLR1(LR0Test.ConstructTestGrammar(out S, out T, out F)); ParseTree tree = parser.Parse("((x) * t) * foo"); Assert.IsNotNull(tree); Assert.IsNotNull(tree.Root); Assert.AreEqual(3, tree.Root.Children.Count); Assert.IsNotNull(tree.Root.Children[0].NonTerminal); Assert.AreEqual("*", tree.Root.Children[1].Token.Value); Assert.IsNotNull(tree.Root.Children[2].NonTerminal); Assert.AreEqual("foo", tree.Root.Children[2].Children[0].Token.Value); }
public void SLR1InvalidGrammar() { LRParserBase parser = new SLR1(new CPointerHandling()); parser.Parse("x = y"); }