public override void Visit(FuncRule rule) { //TODO : Support for using lambdas to select values. //if(!root) throw new InvalidOperationException("Json Rule Tree had multiple different selectors."); //return this; }
public void TestRecursive() { var op = Grammar.MatchAnyString("+ -"); var digit = new RegexRule("\\d+"); Rule expressionA = null; var recursiveExpression = new FuncRule(() => expressionA); var expression = digit + recursiveExpression; expressionA = (op + digit + recursiveExpression) | Grammar.End(); Assert.IsTrue(expression.Match("1")); Assert.IsTrue(expression.Match("1+2")); Assert.IsTrue(expression.Match("1+2+3")); }
public virtual void Visit(FuncRule visitee) => Visit((Rule)visitee);