public boolean nextKeyword()

in commons-geometry-io-euclidean/src/main/java/org/apache/commons/geometry/io/euclidean/threed/obj/AbstractObjParser.java [58:91]


    public boolean nextKeyword() {
        currentKeyword = null;

        // advance to the next line if not at the start of a line
        if (parser.getColumnNumber() != 1) {
            discardDataLine();
        }

        // search for the next keyword
        while (currentKeyword == null && parser.hasMoreCharacters()) {
            if (!nextDataLineContent() ||
                    parser.peekChar() == ObjConstants.COMMENT_CHAR) {
                // use a standard line discard here so we don't interpret line continuations
                // within comments; the interpreted OBJ content should be the same regardless
                // of the presence of comments
                parser.discardLine();
            } else if (parser.getColumnNumber() != 1) {
                throw parser.parseError("non-blank lines must begin with an OBJ keyword or comment character");
            } else if (!readKeyword()) {
                throw parser.unexpectedToken("OBJ keyword");
            } else {
                final String keywordValue = parser.getCurrentToken();

                handleKeyword(keywordValue);

                currentKeyword = keywordValue;

                // advance past whitespace to the next data value
                discardDataLineWhitespace();
            }
        }

        return currentKeyword != null;
    }