class BaseFileListener {

    public static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) {

        // Check for stack to be non empty.
        checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT);

        // Data Model tree root node is set.
        if (listener.getParsedDataStack().peek() instanceof YangModule
                || listener.getParsedDataStack().peek() instanceof YangSubModule) {
            listener.setRootNode((YangNode) listener.getParsedDataStack().pop());
        } else {
            throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT));
        }

        // Check if stack is empty.
        checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT);
    }

    private  BaseFileListener();

}