public static void ParseFunctionReferenceTwoArguments() { var expression = "concat('aaa', 'bbb')"; var actual = ArmExpressionParser.Parse(expression); var expected = new ArmInvocationExpressionAst( expression: new ArmFunctionReferenceAst( name: new IdentifierToken("concat") ), argumentList: new ArmArgumentListAst( openParen: new OpenParenToken(), arguments: new List <ArmExpressionAst>() { new ArmStringLiteralExpressionAst( new StringLiteralToken("aaa") ), new ArmStringLiteralExpressionAst( new StringLiteralToken("bbb") ) }, closeParen: new CloseParenToken() ) ); ParserHelper.AssertAreEqual(expected, actual); Assert.AreEqual(expression, actual.ToArmText()); }
private static object Evaluate(ArmExpressionAst node) { return(node switch { ArmInvocationExpressionAst n => ArmExpressionEvaluator.Evaluate(n), ArmNumericLiteralExpressionAst n => ArmExpressionEvaluator.Evaluate(n), ArmStringLiteralExpressionAst n => ArmExpressionEvaluator.Evaluate(n), _ => throw new NotImplementedException() });