private TreeCursor getSibling(int offset) {
        if (parent == null) {
            return null;
        }

        List<TokenTree> siblings = parent.getTree().getChildren();
        int myPosition = siblings.indexOf(this.tree);

        if (myPosition == -1) {
            return null;
        }

        int target = myPosition + offset;
        if (target < 0 || target > siblings.size() - 1) {
            return null;
        }

        return new TreeCursor(siblings.get(target), parent);
    }
Get the next sibling of this tree, if present.

@return Return the nullable next sibling.
smithy-syntax/src/main/java/software/amazon/smithy/syntax/TreeCursor.java