コード例 #1
0
        private static SingleLiteralElement?CreateSingle(string image)
        {
            if (image.EndsWith("f", StringComparison.OrdinalIgnoreCase))
            {
                image = image.Remove(image.Length - 1);
                return(SingleLiteralElement.Parse(image));
            }

            return(null);
        }
コード例 #2
0
 private static SingleLiteralElement CreateSingle(string image, IServiceProvider services)
 {
     if (image.EndsWith("f", StringComparison.OrdinalIgnoreCase) == true)
     {
         image = image.Remove(image.Length - 1);
         return(SingleLiteralElement.Parse(image, services));
     }
     else
     {
         return(null);
     }
 }
コード例 #3
0
        private static LiteralElement?CreateImplicitReal(string image)
        {
            var realType = builderOptions.RealLiteralDataType;

            switch (realType)
            {
            case RealLiteralDataType.Double:
                return(DoubleLiteralElement.Parse(image));

            case RealLiteralDataType.Single:
                return(SingleLiteralElement.Parse(image));

            case RealLiteralDataType.Decimal:
                return(DecimalLiteralElement.Parse(image));

            default:
                Debug.Fail("Unknown value");
                return(null);
            }
        }
コード例 #4
0
        private static LiteralElement CreateImplicitReal(string image, IServiceProvider services)
        {
            ExpressionOptions   options  = (ExpressionOptions)services.GetService(typeof(ExpressionOptions));
            RealLiteralDataType realType = options.RealLiteralDataType;

            switch (realType)
            {
            case RealLiteralDataType.Double:
                return(DoubleLiteralElement.Parse(image, services));

            case RealLiteralDataType.Single:
                return(SingleLiteralElement.Parse(image, services));

            case RealLiteralDataType.Decimal:
                return(DecimalLiteralElement.Parse(image, services));

            default:
                Debug.Fail("Unknown value");
                return(null);
            }
        }