コード例 #1
0
        public Exception GetException()
        {
            var begin = index;

            if (begin >= length)
            {
                begin = length - 1;
            }

            int line      = 1;
            int lineBegin = 0;
            int column    = 1;

            for (int i = 0; i < begin; ++i)
            {
                if (chars[i] == '\n')
                {
                    ++line;

                    lineBegin = i;
                }
            }

            column = begin - lineBegin + 1;

            var exception = new JsonDeserializeException
            {
                Line   = line,
                Column = column,
                Index  = begin,
                Text   = chars[begin].ToString()
            };

            return(exception);
        }
コード例 #2
0
        public Exception GetException()
        {
            int line      = 1;
            var lineBegin = begin;

            if (current >= end)
            {
                current = end;
            }

            for (var i = begin; i <= current; ++i)
            {
                if (*i == '\n')
                {
                    ++line;
                    lineBegin = i;
                }
            }

            var column    = (int)(current - lineBegin + 1);
            var exception = new JsonDeserializeException
            {
                Line   = line,
                Column = column,
                Index  = (int)(current - begin),
                Text   = (*current).ToString()
            };

            return(exception);
        }
コード例 #3
0
        private Exception GetException()
        {
            var begin = this.index;

            if (begin >= length)
            {
                begin = length - 1;
            }

            int line      = 1;
            int lineBegin = 0;
            int column    = 1;

            for (int i = 0; i < begin; i++)
            {
                if (chars[i] == '\n')
                {
                    ++line;

                    lineBegin = i;
                }
            }

            column = begin - lineBegin + 1;

            var exception = new JsonDeserializeException();

            exception.Line   = line;
            exception.Column = column;
            exception.Index  = begin;
            exception.Text   = chars[begin].ToString();

            return(exception);
        }