示例#1
0
        private object EvaluateExpression(VisualizerExpressionNode theExpression)
        {
            switch (theExpression.InnerExpression)
            {
            case NumberLiteralNode numberLiteralNode:
                return(numberLiteralNode.Value);

            case ValueReferenceStatementNode valueReferenceStatementNode:
                return(EvaluateValueReferenceExpression(valueReferenceStatementNode));

            case ItemNameNode itemNameNode:
                return(itemNameNode.Value);

            case CharacterLiteralNode characterLiteralNode:
                return(characterLiteralNode.Value);

            default:
                throw new NotImplementedException("Unknown visualizer expression");
            }
        }
        private object EvaluateExpression(VisualizerExpressionNode theExpression)
        {
            switch (theExpression.InnerExpression)
            {
            case NumberLiteralNode numberLiteralNode:
                return(numberLiteralNode.Value);

            case ValueReferenceStatementNode valueReferenceStatementNode:
                return(EvaluateValueReferenceExpression(valueReferenceStatementNode));

            case CounterReferenceNode counterReferenceNode:
                var counterContext = this.context.GetCounterContextByName(counterReferenceNode.CounterName);
                return(counterContext.CurrentValue);

            case ItemNameNode itemNameNode:
                return(itemNameNode.Value);

            case CharacterLiteralNode characterLiteralNode:
                return(characterLiteralNode.Value);

            default:
                throw new NotImplementedException("Unknown visualizer expression");
            }
        }