예제 #1
0
                public bool MoveNext()
                {
                    bool result = false;

                    Reset();

                    do
                    {
                        object lineobj = null;
                        if (!_iterator.MoveNext())
                        {
                            if (_field.Length != 0)
                            {
                                throw MakeError("newline inside string");
                            }
                            return(false);
                        }
                        else
                        {
                            lineobj = _iterator.Current;
                        }

                        _reader._line_num++;

                        if (lineobj is char)
                        {
                            lineobj = lineobj.ToString();
                        }

                        if (!(lineobj is string))
                        {
                            throw PythonOps.TypeError("expected string or " +
                                                      "Unicode object, {0} found",
                                                      PythonType.GetPythonType(lineobj.GetType()));
                        }

                        string line = lineobj as string;
                        if (!string.IsNullOrEmpty(line))
                        {
                            for (int i = 0; i < line.Length; i++)
                            {
                                char c = line[i];
                                if (c == '\0')
                                {
                                    throw MakeError("line contains NULL byte");
                                }

                                ProcessChar(c);
                            }
                        }

                        ProcessChar('\0');
                        result = true;
                    } while (_state != State.StartRecord);

                    return(result);
                }