public IToken nextToken() {
        if (m_currentOffset >= (m_docOffset + m_docLength)) {
            return Token.EOF;
        }

        IToken result = Token.UNDEFINED;
        int startOffset = m_currentOffset;
        int length = 0;
        try {
            // Get line information
            IRegion lineRegion = m_document.getLineInformationOfOffset(m_currentOffset);
            int lineMinOffset = lineRegion.getOffset();
            int lineMaxOffset = lineMinOffset + lineRegion.getLength();
            // Read char
            char current = m_document.getChar(m_currentOffset++);
            length++;
            // Check if we are at the end of the line
            if (current == '\n')
            {
                result = Token.WHITESPACE;
                m_tokenOffset = startOffset;
                m_tokenLength = length;
                m_currentColumn = 0;
            }
            else if (current == m_delimiter) {
                result = new CSVToken(CSVTokenType.SEPARATOR,
                                      m_currentColumn++);
                m_tokenOffset = startOffset;
                m_tokenLength = length;
                //System.out.println("Token found [" + m_document.get(m_tokenOffset, m_tokenLength) + "]");
            } else {
                // Look for the next delimiter or the next line
                boolean scan = true;
                while (scan) {
                    // check if we are at the end of the line
                    if (m_currentOffset >= lineMaxOffset) {
                        CSVTokenType type = ((m_currentColumn % 2) == 0) ? CSVTokenType.ODD_COLUMN : CSVTokenType.EVEN_COLUMN;
                        result = new CSVToken(type, m_currentColumn);

                        m_tokenOffset = startOffset;
                        m_tokenLength = length;
                        m_currentColumn= 0;
                        //System.out.println("Token found [" + m_document.get(m_tokenOffset, m_tokenLength) + "]");
                        scan = false;
                    }
                    else
                    {
                        // iterate until a delimiter is found
                        char next = m_document.getChar(m_currentOffset);
                        if (next == m_delimiter) {
                            CSVTokenType type = ((m_currentColumn % 2) == 0) ? CSVTokenType.ODD_COLUMN : CSVTokenType.EVEN_COLUMN;
                            result = new CSVToken(type, m_currentColumn);

                            m_tokenOffset = startOffset;
                            m_tokenLength = length;
                            //System.out.println("Token found [" + m_document.get(m_tokenOffset, m_tokenLength) + "]");
                            scan = false;
                        }
                        else
                        {
                            m_currentOffset++;
                            length++;
                        }
                    }
                }
            }
        } catch (BadLocationException e) {
            e.printStackTrace();
            result = Token.EOF;
        }
        return result;
    }