Esempio n. 1
0
        /// <summary>
        /// Evaluates the current input as a integer
        /// </summary>
        /// <returns></returns>
        public NumberExpression EvaluateInt()
        {
            NumberExpression retVal = null;

            int backup = Index;

            int  len        = 0;
            bool digitFound = false;

            Types.Type type = EFSSystem.IntegerType;

            if (Index < Buffer.Length && Buffer[Index] == '-')
            {
                len += 1;
            }
            while (Index + len < Buffer.Length && Char.IsDigit(Buffer[Index + len]))
            {
                digitFound = true;
                len        = len + 1;
            }

            if (len > 0 && Index + len < Buffer.Length && Buffer[Index + len] == '.')
            {
                type = EFSSystem.DoubleType;
                len  = len + 1;
                while (Index + len < Buffer.Length && Char.IsDigit(Buffer[Index + len]))
                {
                    len = len + 1;
                }
            }

            if (Index + len < Buffer.Length && Buffer[Index + len] == 'E')
            {
                type = EFSSystem.DoubleType;
                len  = len + 1;
                while (Index + len < Buffer.Length && Char.IsDigit(Buffer[Index + len]))
                {
                    len = len + 1;
                }
            }

            if (digitFound)
            {
                string str = new String(Buffer, Index, len);
                retVal = new NumberExpression(Root, str, type);
                Index += len;
            }

            if (retVal == null)
            {
                Index = backup;
            }

            return(retVal);
        }
Esempio n. 2
0
 /// <summary>
 ///     Visits a Number expression
 /// </summary>
 /// <param name="numberExpression"></param>
 protected virtual void VisitNumberExpression(NumberExpression numberExpression)
 {
 }
Esempio n. 3
0
 /// <summary>
 ///     Visits a Number expression
 /// </summary>
 /// <param name="numberExpression"></param>
 protected virtual void VisitNumberExpression(NumberExpression numberExpression)
 {
 }
Esempio n. 4
0
        /// <summary>
        ///     Evaluates the current input as a integer
        /// </summary>
        /// <returns></returns>
        public NumberExpression EvaluateInt()
        {
            NumberExpression retVal = null;

            int start = Index;

            int len = 0;
            bool digitFound = false;
            Type type = EfsSystem.Instance.IntegerType;

            if (Index < Buffer.Length && Buffer[Index] == '-')
            {
                len += 1;
            }
            while (Index + len < Buffer.Length && Char.IsDigit(Buffer[Index + len]))
            {
                digitFound = true;
                len = len + 1;
            }

            if (len > 0 && Index + len < Buffer.Length && Buffer[Index + len] == '.')
            {
                type = EfsSystem.Instance.DoubleType;
                len = len + 1;
                while (Index + len < Buffer.Length && Char.IsDigit(Buffer[Index + len]))
                {
                    len = len + 1;
                }
            }

            if (Index + len < Buffer.Length && Buffer[Index + len] == 'E')
            {
                type = EfsSystem.Instance.DoubleType;
                len = len + 1;
                while (Index + len < Buffer.Length && Char.IsDigit(Buffer[Index + len]))
                {
                    len = len + 1;
                }
            }

            if (digitFound)
            {
                string str = new String(Buffer, Index, len);
                retVal = new NumberExpression(Root, RootLog, str, type, start, str.Length);
                Index += len;
            }

            if (retVal == null)
            {
                Index = start;
            }

            return retVal;
        }