Esempio n. 1
0
        /// <summary>
        /// Return source code representation of an expression.
        /// </summary>
        public string FormatExpression(LaxExpression expr)
        {
            if (expr == null)
                throw new ArgumentNullException("expr");
            switch (expr.Type)
            {
                case ExprType.Assignment:
                    return FormatAssignment((Assignment)expr);
                case ExprType.BinaryOp:
                    return FormatBinaryOp((BinaryOp)expr);
                case ExprType.Identifier:
                    return FormatIdentifier((Identifier)expr);
                case ExprType.Literal:
                    return FormatValue((Literal)expr);
                case ExprType.FunctionCall:
                    return FormatFunctionCall((FunctionCall)expr);
            }

            throw new NotImplementedException(expr.GetType().Name);
        }