public final int consumeWhile(IntPredicate predicate) {
        int startPosition = position;
        char ch = peek();
        while (ch != EOF && predicate.test(ch)) {
            skip();
            ch = peek();
        }
        return position - startPosition;
    }
Reads a lexeme from the expression while the given {@code predicate} matches each peeked character.

@param predicate Predicate that filters characters.
@return Returns the consumed lexeme (or an empty string on no matches).
smithy-utils/src/main/java/software/amazon/smithy/utils/SimpleParser.java