예제 #1
0
        /// <summary>
        /// numeric :
        ///     PLUS_SIGN? UNSIGNED_INTEGER
        ///     | APPROXIMATE_NUM_LIT
        ///     ;
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static int ToInteger(this PlSqlParser.NumericContext context)
        {
            string value = null;

            var unsigned_integer = context.UNSIGNED_INTEGER();

            if (unsigned_integer != null)
            {
                value = unsigned_integer.GetText();
            }
            else
            {
                var approximate_num_lit = context.APPROXIMATE_NUM_LIT();
                value = approximate_num_lit.GetText();
            }

            try
            {
                return(int.Parse(value));
            }
            catch (Exception e)
            {
                throw;
            }
        }
예제 #2
0
        /// <summary>
        /// UNSIGNED_INTEGER | APPROXIMATE_NUM_LIT
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override object VisitNumeric([NotNull] PlSqlParser.NumericContext context)
        {
            var unsigned = context.UNSIGNED_INTEGER();

            if (unsigned != null)
            {
                return(GetUnsignedInteger(unsigned));
            }

            else
            {
                // FLOAT_FRAGMENT ('E' ('+'|'-')? (FLOAT_FRAGMENT | [0-9]+))? ('D' | 'F')?;

                var litt = context.APPROXIMATE_NUM_LIT().GetText();
                Stop();
            }

            return(base.VisitNumeric(context));
        }