Read the next line into the tokenizer.

@return The next line, or {@code null}.
357926
public boolean nextLineExceptComments() throws IOException {
    while(nextLine()) {
      if(comment == null || !comment.reset(buf).matches()) {
        tokenizer.initialize(buf, 0, buf.length());
        return true;
      }
    }
    return false;
  }
1230919
public EventRecord getNext() {
    try {
	String line = reader.readLine();
	if (line != null) {
	    if (firstLine == null)
		firstLine = new String(line);
	    offset += line.length() + 1;
	    return parseLine(line);
	}
    } catch (IOException e) {
      e.printStackTrace();
    }
    return null;
  }
768256
@Nullable
    public JsonToken next() throws IOException, JsonException {
        if (unreadToken != null) {
            JsonToken tmp = unreadToken;
            unreadToken = null;
            return tmp;
        }

        while (lastChar >= 0) {
            if (lastChar == 0) {
                if (!readNextChar()) {
                    break;
                }
            }
            if (lastChar == JsonToken.kNewLine ||
                lastChar == JsonToken.kCarriageReturn ||
                lastChar == JsonToken.kSpace ||
                lastChar == JsonToken.kTab) {
                lastChar = 0;
                continue;
            }

            if (lastChar == JsonToken.kDoubleQuote) {
                return nextString();
            } else if (lastChar == '.' || lastChar == '-' || (lastChar >= '0' && lastChar <= '9')) {
                return nextNumber();
            } else if (lastChar == '_' ||
                       (lastChar >= 'a' && lastChar <= 'z') ||
                       (lastChar >= 'A' && lastChar <= 'Z')) {
                return nextToken();
            } else if (lastChar < 0x20 || lastChar >= 0x7F) {
                // UTF-8 characters are only allowed inside JSON string literals.
                throw newParseException("Illegal character in JSON structure: '\\u%04x'", lastChar);
            } else {
                return nextSymbol();
            }
        }

        return null;
    }
519749
public String getToken(){
		if(this.tokenPosition>0){
			String[] ar = StringUtils.split(this.line, null, this.tokenPosition+1);
			if(ar!=null && ar.length>(this.tokenPosition-1)){
				return StringUtils.trim(ar[this.tokenPosition-1]);
			}
		}
		return null;
	}
520066
public Object getNextData()
    {
        try   {
            String strNext = m_daIn.readUTF();
            return strNext;
        } catch (IOException ex)    {
            ex.printStackTrace();
            return null;
        }
    }
939424
private void getNextToken(StreamTokenizer tokenizer) throws IOException, ParseException {
        if (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
            throw new ParseException("premature end of line", tokenizer.lineno());
        }
        if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
            throw new ParseException(PREMATURE_END_OF_FILE, tokenizer.lineno());
        } else if ((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
            tokenizer.ttype = StreamTokenizer.TT_WORD;
        } else if ((tokenizer.ttype == StreamTokenizer.TT_WORD) && (tokenizer.sval.equals("?"))) {
            tokenizer.ttype = '?';
        }
    }
655334
public final String getNextLine() throws IOException {
    String str = null;
    if (buf_end - buf_pos <= 0) {
      if (fillBuffer() < 0) {
        return null;
      }
    }
    int lineend = -1;
    for (int i = buf_pos; i < buf_end; i++) {
      if (buffer[i] == '\n') {
        lineend = i;
        break;
      }
      // check for only '\r' as line end
      if ((i - buf_pos > 0) && buffer[i - 1] == '\r') {
        lineend = i - 1;
        break;
      }
    }
    if (lineend < 0) {
      StringBuilder input = new StringBuilder(256);
      int c;
      int lastC = 0;
      while (((c = read()) != -1) && (c != '\n') && (lastC != '\r')) {
        input.append((char) c);
        lastC = c;
      }
      if ((c == -1) && (input.length() == 0)) {
        return null;
      }
      return input.toString();
    }
    if (lineend > 0 && buffer[lineend] == '\n' && buffer[lineend - 1] == '\r') {
      str = new String(buffer, buf_pos, lineend - buf_pos - 1);
    } else {
      str = new String(buffer, buf_pos, lineend - buf_pos);
    }
    buf_pos = lineend + 1;
    return str;
  }
531574
public String nextToken() 
    {
        if (m_tokenOffset_ < 0) {
            if (m_nextOffset_ < 0) {
                throw new NoSuchElementException("No more tokens in String");   
            }
            // pre-calculations of tokens not done
            if (m_returnDelimiters_) {
                int tokenlimit = 0;
                int c = UTF16.charAt(m_source_, m_nextOffset_);
                boolean contains = delims == null 
                    ? m_delimiters_.contains(c) 
                    : c < delims.length && delims[c];
                if (contains) {
                     if (m_coalesceDelimiters_) {
                        tokenlimit = getNextNonDelimiter(m_nextOffset_);
                     } else {
                        tokenlimit = m_nextOffset_ + UTF16.getCharCount(c);
                        if (tokenlimit == m_length_) {
                            tokenlimit = -1;
                        }
                     }
                }
                else {
                    tokenlimit = getNextDelimiter(m_nextOffset_);
                }
                String result;
                if (tokenlimit < 0) {
                    result = m_source_.substring(m_nextOffset_);
                }
                else {
                    result = m_source_.substring(m_nextOffset_, tokenlimit);
                }
                m_nextOffset_ = tokenlimit;
                return result;
            }
            else {
                int tokenlimit = getNextDelimiter(m_nextOffset_);
                String result;
                if (tokenlimit < 0) {
                    result = m_source_.substring(m_nextOffset_);
                    m_nextOffset_ = tokenlimit;
                }
                else {
                    result = m_source_.substring(m_nextOffset_, tokenlimit);
                    m_nextOffset_ = getNextNonDelimiter(tokenlimit);
                }
                
                return result;
            }
        }
        // count was called before and we have all the tokens
        if (m_tokenOffset_ >= m_tokenSize_) {
            throw new NoSuchElementException("No more tokens in String");
        }
        String result;
        if (m_tokenLimit_[m_tokenOffset_] >= 0) {
            result = m_source_.substring(m_tokenStart_[m_tokenOffset_],
                                         m_tokenLimit_[m_tokenOffset_]);
        }
        else {
            result = m_source_.substring(m_tokenStart_[m_tokenOffset_]);
        }
        m_tokenOffset_ ++;
        m_nextOffset_ = -1;
        if (m_tokenOffset_ < m_tokenSize_) {
            m_nextOffset_ = m_tokenStart_[m_tokenOffset_];
        }
        return result;
    }
427310
public String next() {
	if (!hasNext()) {
	    throw new NoSuchElementException();
	}

	String token = tokenizer.next();

	// Determine whether the next token to return could be the start of a
	// recognized compound token
	CompoundTokens compounds = compoundTokens.get(token);
	
	// Determine how many tokens are needed at most and see if any grouping
	// exists
	if (compounds != null) {
	    List<String> nextTokens = tokenizer.peek(compounds.maxTokens());
	    Duple<Integer,String> compound = compounds.findMatch(nextTokens);
	    if (compound != null) {
		// shift off the number of extra tokens in the compound
		for (int i = 0; i < compound.x; ++i) 
		    tokenizer.next();
		return compound.y;
	    }
	    else return token;
	}
	
	// If there was no possibility of grouping this token, then return it by
	// itself
	return token;
    }
351930
private Indent getIndent() {
		skipEmptyLines();
		if (index < tokens.size()) {
			Token token = tokens.get(index);
			if (token.kind == Indent) {
				return new Indent(token.text, token.start);
			}
			return null;
		}
		return null;
	}
1310392
public String readLineUntilBoundary() throws IOException {
		StringBuilder bldr = new StringBuilder();
		while (true) {
			int b = read();
			if (bldr.indexOf(boundary) == 0) {
				leftover = ByteBuffer.wrap(boundaryBytes);
				return null;
			} else if (b == -1 || b == 10) {
				break;
			} else if (b != '\r') {
				bldr.append((char) ((byte) b));
			}
		}
		return bldr.toString();
	}
618078
private int nextToken(StreamTokenizer tokeniser, Reader in, boolean ignoreEOF) throws IOException, ParserException {
        int token = tokeniser.nextToken();
        if (!ignoreEOF && token == StreamTokenizer.TT_EOF) {
            throw new ParserException("Unexpected end of file", getLineNumber(tokeniser, in));
        }
        return token;
    }
224711
private Block readLines() throws IOException
    {
        final Block block = new Block();
        final StringBuilder sb = new StringBuilder(80);
        int c = this.reader.read();
        LinkRef lastLinkRef = null;
        while (c != -1)
        {
            sb.setLength(0);
            int pos = 0;
            boolean eol = false;
            while (!eol)
            {
                switch (c)
                {
                case -1:
                    eol = true;
                    break;
                case '\n':
                    c = this.reader.read();
                    if (c == '\r')
                    {
                        c = this.reader.read();
                    }
                    eol = true;
                    break;
                case '\r':
                    c = this.reader.read();
                    if (c == '\n')
                    {
                        c = this.reader.read();
                    }
                    eol = true;
                    break;
                case '\t':
                {
                    final int np = pos + (4 - (pos & 3));
                    while (pos < np)
                    {
                        sb.append(' ');
                        pos++;
                    }
                    c = this.reader.read();
                    break;
                }
                default:
                    if (c != '<' || !this.config.panicMode)
                    {
                        pos++;
                        sb.append((char)c);
                    }
                    else
                    {
                        pos += 4;
                        sb.append("&lt;");
                    }
                    c = this.reader.read();
                    break;
                }
            }

            final Line line = new Line();
            line.value = sb.toString();
            line.init();

            // Check for link definitions
            boolean isLinkRef = false;
            String id = null, link = null, comment = null;
            if (!line.isEmpty && line.leading < 4 && line.value.charAt(line.leading) == '[')
            {
                line.pos = line.leading + 1;
                // Read ID up to ']'
                id = line.readUntil(']');
                // Is ID valid and are there any more characters?
                if (id != null && line.pos + 2 < line.value.length())
                {
                    // Check for ':' ([...]:...)
                    if (line.value.charAt(line.pos + 1) == ':')
                    {
                        line.pos += 2;
                        line.skipSpaces();
                        // Check for link syntax
                        if (line.value.charAt(line.pos) == '<')
                        {
                            line.pos++;
                            link = line.readUntil('>');
                            line.pos++;
                        }
                        else
                        {
                            link = line.readUntil(' ', '\n');
                        }

                        // Is link valid?
                        if (link != null)
                        {
                            // Any non-whitespace characters following?
                            if (line.skipSpaces())
                            {
                                final char ch = line.value.charAt(line.pos);
                                // Read comment
                                if (ch == '\"' || ch == '\'' || ch == '(')
                                {
                                    line.pos++;
                                    comment = line.readUntil(ch == '(' ? ')' : ch);
                                    // Valid linkRef only if comment is valid
                                    if (comment != null)
                                    {
                                        isLinkRef = true;
                                    }
                                }
                            }
                            else
                            {
                                isLinkRef = true;
                            }
                        }
                    }
                }
            }

            // To make compiler happy: add != null checks
            if (isLinkRef && id != null && link != null)
            {
                if (id.toLowerCase().equals("$profile$"))
                {
                    this.emitter.useExtensions = this.useExtensions = link.toLowerCase().equals("extended");
                    lastLinkRef = null;
                }
                else
                {
                    // Store linkRef and skip line
                    final LinkRef lr = new LinkRef(link, comment, comment != null
                            && (link.length() == 1 && link.charAt(0) == '*'));
                    this.emitter.addLinkRef(id, lr);
                    if (comment == null)
                    {
                        lastLinkRef = lr;
                    }
                }
            }
            else
            {
                comment = null;
                // Check for multi-line linkRef
                if (!line.isEmpty && lastLinkRef != null)
                {
                    line.pos = line.leading;
                    final char ch = line.value.charAt(line.pos);
                    if (ch == '\"' || ch == '\'' || ch == '(')
                    {
                        line.pos++;
                        comment = line.readUntil(ch == '(' ? ')' : ch);
                    }
                    if (comment != null)
                    {
                        lastLinkRef.title = comment;
                    }

                    lastLinkRef = null;
                }

                // No multi-line linkRef, store line
                if (comment == null)
                {
                    line.pos = 0;
                    block.appendLine(line);
                }
            }
        }

        return block;
    }
250208
protected String getNextLine(int newlineCount) throws IOException {
        if (newlineCount == 0) {
            return "";
        }
        StringBuffer str = new StringBuffer();
        int b;
        while (pis.available() > 0) {
            b = pis.read();
            if (b == -1) {
                return "";
            }
            if (b == '\n') {
                newlineCount--;
                if (newlineCount == 0) {
                    log.debug("Read lines: " + str.toString());
                    String[] lines = str.toString().split("\n");
                    // FIXME: this leads to queuing lines so we will have time lag!
                    return lines[lines.length - 1];
                }
            }
            str.append((char) b);
        }
        return "";
    }
800392
private String readLine()
    {
        try
        {
            BufferedReader rin = new BufferedReader(new InputStreamReader(System.in));
            return rin.readLine();
        }
        catch (Exception e)
        {
            return "";
        }
    }
208882
public boolean nextLine() {
	while (isValidIndex() && text[pos] != '\n') {
	    next();
	}
	if (isValidIndex() && text[pos] == '\n') {
	    next();
	    return isValidIndex();
	}
	return false;
    }
146667
public Token nextToken() {

        if(lexer._input == null) {
            throw new IllegalStateException("nextToken requires a non-null input stream.");
        } else {
            int tokenStartMarker = lexer._input.mark();

            try {
                Token ttype1;
                label110:
                while(!lexer._hitEOF) {
                    lexer._token = null;
                    lexer._channel = Token.DEFAULT_CHANNEL;
                    lexer._tokenStartCharIndex = lexer._input.index();
                    lexer._tokenStartCharPositionInLine = ((LexerATNSimulator)lexer.getInterpreter()).getCharPositionInLine();
                    lexer._tokenStartLine = ((LexerATNSimulator)lexer.getInterpreter()).getLine();
                    lexer._text = null;


                    do {
                        lexer._type = 0;

                        int ttype;
                        try {
                            ttype = ((LexerATNSimulator)lexer.getInterpreter()).match(lexer._input, lexer._mode);
                        } catch (LexerNoViableAltException var7) {
                            lexer.notifyListeners(var7);
                            lexer.recover(var7);
                            ttype = -3;
                        }

                        if(lexer._input.LA(1) == -1) {
                            lexer._hitEOF = true;
                        }

                        if(lexer._type == 0) {
                            lexer._type = ttype;
                        }

                        if(lexer._type == -3) {
                            continue label110;
                        }
                    } while(lexer._type == -2);

                    if(lexer._token == null) {
                        lexer.emit();
                    }

                    ttype1 = lexer._token;
                    //log.trace("return token: >" + ttype1.getText()+"< " + ttype1.getType());
                    return ttype1;
                }
                // recover from unexpected EOF
                eof = true;
                if (!ls.isBalanced()) {
                    return generateEOFRecover();
                }
                log.trace("lexer state is balanced - emitEOF");
                lexer.emitEOF();
                ttype1 = lexer._token;
                return ttype1;
            } finally {
                lexer._input.release(tokenStartMarker);
            }
        }
    }