Exemplo n.º 1
0
        protected override void ComputeToken(int id, string name, PatternType type, string pattern, ExpressionContext context)
        {
            ExpressionParserOptions options = context.ParserOptions;

            char digitsBeforePattern = (options.RequireDigitsBeforeDecimalPoint ? '+' : '*');

            pattern = string.Format(pattern, digitsBeforePattern, options.DecimalSeparator);

            this.SetData(id, name, type, pattern);
        }
Exemplo n.º 2
0
Arquivo: Single.cs Projeto: Nucs/Regen
        public static SingleLiteralElement Parse(string image, IServiceProvider services)
        {
            ExpressionParserOptions options = (ExpressionParserOptions)services.GetService(typeof(ExpressionParserOptions));
            SingleLiteralElement    element = new SingleLiteralElement();

            try {
                float value = options.ParseSingle(image);
                return(new SingleLiteralElement(value));
            } catch (OverflowException) {
                element.OnParseOverflow(image);
                return(null);
            }
        }
Exemplo n.º 3
0
        public static DecimalLiteralElement Parse(string image, IServiceProvider services)
        {
            ExpressionParserOptions options = (ExpressionParserOptions)services.GetService(typeof(ExpressionParserOptions));
            DecimalLiteralElement   element = new DecimalLiteralElement();

            try
            {
                decimal value = options.ParseDecimal(image);
                return(new DecimalLiteralElement(value));
            }
            catch (OverflowException ex)
            {
                element.OnParseOverflow(image);
                return(null);
            }
        }
Exemplo n.º 4
0
        protected override void ComputeToken(int id, string name, PatternType type, string pattern, ExpressionContext context)
        {
            ExpressionParserOptions options = context.ParserOptions;

            this.SetData(id, name, type, options.FunctionArgumentSeparator.ToString());
        }