public void One_Of_Works() { IRuleParser AlphabetParser() { return(Starts .With ( The.Word("a"), The.Word("b"), The.Word("c"), The.Word("d") ) .ReturnsNode("abcd")); } IRuleParser AberahamParser() { return(Starts .With ( The.Word("a"), The.Word("b"), The.Word("e"), The.Word("raham") // laziness ) .ReturnsNode("aberaham")); } var node = new TestNode(); var oneOfParser = Starts .With ( One.Of ( A.Rule <string>(AlphabetParser, t => node.name = t), A.Rule <string>(AberahamParser, t => node.name = t) ) ) .ReturnsNode(node); string src = "a b e raham"; var tokens = new Lexer().ToTokens(src); var result = oneOfParser.FeedAll(tokens); var resultNode = result.AssertComplete <TestNode>(); Assert.Equal(node, resultNode); Assert.Equal("aberaham", resultNode.name); }