@Override
    public IdlToken next() {
        if (getToken().getIdlToken() == IdlToken.EOF) {
            throw new NoSuchElementException();
        }
        appendCurrentTokenToFirstTree();
        return tokens.get(++cursor).getIdlToken();
    }
Captures tokens to a stack of token trees.
smithy-syntax/src/main/java/software/amazon/smithy/syntax/CapturingTokenizer.java