lojix/logic/src/main/com/thesett/aima/logic/fol/isoprologparser/PrologParser.java
protected Token consumeToken(int kind) throws SourceCodeException
    {
        Token nextToken = tokenSource.peek();

        if (nextToken.kind != kind)
        {
            throw new SourceCodeException("Was expecting " + tokenImage[kind] + " but got " +
                tokenImage[nextToken.kind] + ".", null, null, null,
                new SourceCodePositionImpl(nextToken.beginLine, nextToken.beginColumn, nextToken.endLine,
                    nextToken.endColumn));
        }
        else
        {
            nextToken = tokenSource.poll();

            return nextToken;
        }
    }
protected Token consumeToken(int kind) throws SourceCodeException
    {
        Token nextToken = tokenSource.peek();

        if (nextToken.kind != kind)
        {
            throw new SourceCodeException("Was expecting " + tokenImage[kind] + " but got " +
                tokenImage[nextToken.kind] + ".", null, null, null,
                new SourceCodePositionImpl(nextToken.beginLine, nextToken.beginColumn, nextToken.endLine,
                    nextToken.endColumn));
        }
        else
        {
            nextToken = tokenSource.poll();

            return nextToken;
        }
    }
Consumes a token of the expected kind from the token sequence. If the next token in the sequence is not of the
expected kind an error will be raised.

@param  kind The kind of token to consume.

@return The consumed token of the expected kind.

@throws SourceCodeException If the next token in the sequence is not of the expected kind.