evaluate function with more than one parameters (ExpressionListNode issue)

Jul 25, 2014 at 3:12 PM
Edited Jul 25, 2014 at 3:14 PM
I'm trying to do (for example) round( 3.4455, 2) (created by my or created by BuiltIn)

var ArgList = new NonTerminal("ArgList", typeof (ExpressionListNode));
var FunctionCall = new NonTerminal("FunctionCall", typeof(FunctionCallNode));

ArgList.Rule = MakeStarRule(ArgList, comma, Expr);
FunctionCall.Rule = Expr + PreferShiftHere() + "(" + ArgList + ")" | Expr + PreferShiftHere();

it works perfect when the function have only one parameter, but with two parameters it shows the following error.

Attempt to evaluate NULL AST node. The AST node for term 'Expr+' was not created during parsing.

The message is very clear, MakeStarRule creates this NonTerminal with name Expr+ (this node has TermFlags.IsListContainer but doesn't have any AstNode to execute something.

don't know if problem is in ExpressionListNode when doing DoEvaluate, and why only the first node in the list is Expr+ (this node have a child where is the Number) the other is Comma and Number

any idea how to fix this?

Jul 25, 2014 at 8:04 PM
Look at sample expression evaluator. I just tried the following expression that uses functions from Math class:

x = Min(2, 3) + Round(3.4567, 2)

It gives the correct result - 5.46
Apparently, functions with 2 parameters work there
Jul 29, 2014 at 11:26 AM
yes..it works perfectly...thank you.