public void ParseInvalidUnexpectedCharacterString() { NonTerminal S, T, F; LR0 parser = new LR0(ConstructTestGrammar(out S, out T, out F)); var tree = parser.Parse("((x)*t)**"); }
public void ParseInvalidEarlyTerminatingString() { NonTerminal S, T, F; LR0 parser = new LR0(ConstructTestGrammar(out S, out T, out F)); var tree = parser.Parse("((x)*t)*"); }
public void ParseMatchedBrackets() { var lr0 = new LR0(new MatchedBrackets("(", ")")); //This is failing because some part of the LR0 parser is not liking having to match an empty string midway through the parse //This should parse as "(" + "" + ")" lr0.Parse("()"); }
public void ParseValidString() { NonTerminal S, T, F; LR0 parser = new LR0(ConstructTestGrammar(out S, out T, out F)); ParseTree tree = parser.Parse("((x) * y) * 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 ParseMathExpression() { var lr0 = new LR0(new MathExpression()); lr0.Parse("1 * 2"); }
public void ParseMatchedBracketsWithContent() { var lr0 = new LR0(new MatchedBracketsWithContent("(", ")")); lr0.Parse("(a)"); }