/**
 * @file printer_yang.c
 * @author Radek Krejci <rkrejci@cesnet.cz>
 * @author Michal Vasko <mvasko@cesnet.cz>
 * @brief YANG printer
 *
 * Copyright (c) 2015 - 2022 CESNET, z.s.p.o.
 *
 * This source code is licensed under BSD 3-Clause License (the "License").
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/BSD-3-Clause
 */

#define _GNU_SOURCE

#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include "common.h"
#include "compat.h"
#include "log.h"
#include "out.h"
#include "out_internal.h"
#include "plugins_exts.h"
#include "plugins_types.h"
#include "printer_internal.h"
#include "printer_schema.h"
#include "tree.h"
#include "tree_data.h"
#include "tree_schema.h"
#include "tree_schema_internal.h"
#include "xpath.h"

/**
 * @brief Types of the YANG printers
 */
enum lys_ypr_schema_type {
    LYS_YPR_PARSED,   /**< YANG printer of the parsed schema */
    LYS_YPR_COMPILED  /**< YANG printer of the compiled schema */
};

#define YPR_CTX_FLAG_EXTRA_LINE 0x01 /**< Flag for ::ypr_ctx::flags to print extra line in schema */

#define YPR_EXTRA_LINE(COND, PCTX) if (COND) { (PCTX)->flags |= YPR_CTX_FLAG_EXTRA_LINE; }
#define YPR_EXTRA_LINE_PRINT(PCTX) \
    if ((PCTX)->flags & YPR_CTX_FLAG_EXTRA_LINE) { \
        (PCTX)->flags &= ~YPR_CTX_FLAG_EXTRA_LINE; \
        if (DO_FORMAT) { \
            ly_print_((PCTX)->out, "\n"); \
        } \
    }

/**
 * @brief Compiled YANG printer context
 *
 * Note that the YANG extensions API provides getter to the members for the extension plugins.
 */
struct lys_ypr_ctx {
    union {
        struct {
            struct ly_out *out;              /**< output specification */
            uint16_t level;                  /**< current indentation level: 0 - no formatting, >= 1 indentation levels */
            uint16_t flags;                  /**< internal flags for use by printer */
            uint32_t options;                /**< Schema output options (see @ref schemaprinterflags). */
            const struct lys_module *module; /**< schema to print */
        };
        struct lyspr_ctx printer_ctx;
    };

    /* YANG printer specific members */
    enum lys_ypr_schema_type schema; /**< type of the schema to print */
};

/**
 * @brief Print the given text as content of a double quoted YANG string,
 * including encoding characters that have special meanings. The quotation marks
 * are not printed.
 *
 * Follows RFC 7950, section 6.1.3.
 *
 * @param[in] out Output specification.
 * @param[in] text String to be printed.
 * @param[in] len Length of the string from @p text to be printed. In case of -1,
 * the @p text is printed completely as a NULL-terminated string.
 */
static void
ypr_encode(struct ly_out *out, const char *text, ssize_t len)
{
    size_t i, start_len;
    const char *start;
    char special = 0;

    if (!len) {
        return;
    }

    if (len < 0) {
        len = strlen(text);
    }

    start = text;
    start_len = 0;
    for (i = 0; i < (size_t)len; ++i) {
        switch (text[i]) {
        case '\n':
        case '\t':
        case '\"':
        case '\\':
            special = text[i];
            break;
        default:
            ++start_len;
            break;
        }

        if (special) {
            ly_write_(out, start, start_len);
            switch (special) {
            case '\n':
                ly_write_(out, "\\n", 2);
                break;
            case '\t':
                ly_write_(out, "\\t", 2);
                break;
            case '\"':
                ly_write_(out, "\\\"", 2);
                break;
            case '\\':
                ly_write_(out, "\\\\", 2);
                break;
            }

            start += start_len + 1;
            start_len = 0;

            special = 0;
        }
    }

    ly_write_(out, start, start_len);
}

static void
ypr_open(struct ly_out *out, ly_bool *flag)
{
    if (flag && !*flag) {
        *flag = 1;
        ly_print_(out, " {\n");
    }
}

static void
ypr_close(struct lys_ypr_ctx *pctx, ly_bool flag)
{
    if (flag) {
        ly_print_(pctx->out, "%*s}\n", INDENT);
    } else {
        ly_print_(pctx->out, ";\n");
    }
}

static void
ypr_text(struct lys_ypr_ctx *pctx, const char *name, const char *text, ly_bool singleline, ly_bool closed)
{
    const char *s, *t;

    if (singleline) {
        ly_print_(pctx->out, "%*s%s \"", INDENT, name);
    } else {
        ly_print_(pctx->out, "%*s%s\n", INDENT, name);
        LEVEL++;

        ly_print_(pctx->out, "%*s\"", INDENT);
    }
    t = text;
    while ((s = strchr(t, '\n'))) {
        ypr_encode(pctx->out, t, s - t);
        ly_print_(pctx->out, "\n");
        t = s + 1;
        if (*t != '\n') {
            ly_print_(pctx->out, "%*s ", INDENT);
        }
    }

    ypr_encode(pctx->out, t, strlen(t));
    if (closed) {
        ly_print_(pctx->out, "\";\n");
    } else {
        ly_print_(pctx->out, "\"");
    }
    if (!singleline) {
        LEVEL--;
    }
}

static void
yprp_stmt(struct lys_ypr_ctx *pctx, struct lysp_stmt *stmt)
{
    struct lysp_stmt *childstmt;
    const char *s, *t;

    if (stmt->arg) {
        if (stmt->flags) {
            ly_print_(pctx->out, "%*s%s\n", INDENT, stmt->stmt);
            LEVEL++;
            ly_print_(pctx->out, "%*s%c", INDENT, (stmt->flags & LYS_DOUBLEQUOTED) ? '\"' : '\'');
            t = stmt->arg;
            while ((s = strchr(t, '\n'))) {
                ypr_encode(pctx->out, t, s - t);
                ly_print_(pctx->out, "\n");
                t = s + 1;
                if (*t != '\n') {
                    ly_print_(pctx->out, "%*s ", INDENT);
                }
            }
            LEVEL--;
            ypr_encode(pctx->out, t, strlen(t));
            ly_print_(pctx->out, "%c%s", (stmt->flags & LYS_DOUBLEQUOTED) ? '\"' : '\'', stmt->child ? " {\n" : ";\n");
        } else {
            ly_print_(pctx->out, "%*s%s %s%s", INDENT, stmt->stmt, stmt->arg, stmt->child ? " {\n" : ";\n");
        }
    } else {
        ly_print_(pctx->out, "%*s%s%s", INDENT, stmt->stmt, stmt->child ? " {\n" : ";\n");
    }

    if (stmt->child) {
        LEVEL++;
        LY_LIST_FOR(stmt->child, childstmt) {
            yprp_stmt(pctx, childstmt);
        }
        LEVEL--;
        ly_print_(pctx->out, "%*s}\n", INDENT);
    }
}

static void
yprp_extension_instance(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index,
        struct lysp_ext_instance *ext, ly_bool *flag)
{
    struct lysp_stmt *stmt;
    ly_bool child_presence;

    if ((ext->flags & LYS_INTERNAL) || (ext->parent_stmt != substmt) || (ext->parent_stmt_index != substmt_index)) {
        return;
    }

    ypr_open(pctx->out, flag);

    if (ext->def->argname) {
        ly_print_(pctx->out, "%*s%s \"", INDENT, ext->name);
        ypr_encode(pctx->out, ext->argument, -1);
        ly_print_(pctx->out, "\"");
    } else {
        ly_print_(pctx->out, "%*s%s", INDENT, ext->name);
    }

    child_presence = 0;
    LEVEL++;
    LY_LIST_FOR(ext->child, stmt) {
        if (stmt->flags & (LYS_YIN_ATTR | LYS_YIN_ARGUMENT)) {
            continue;
        }
        if (!child_presence) {
            ly_print_(pctx->out, " {\n");
            child_presence = 1;
        }
        yprp_stmt(pctx, stmt);
    }
    LEVEL--;
    if (child_presence) {
        ly_print_(pctx->out, "%*s}\n", INDENT);
    } else {
        ly_print_(pctx->out, ";\n");
    }
}

static void
yprp_extension_instances(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index,
        struct lysp_ext_instance *exts, ly_bool *flag)
{
    LY_ARRAY_COUNT_TYPE u;

    LY_ARRAY_FOR(exts, u) {
        yprp_extension_instance(pctx, substmt, substmt_index, &exts[u], flag);
    }
}

static void
yprc_extension_instances(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index,
        struct lysc_ext_instance *exts, ly_bool *flag)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool inner_flag;

    LY_ARRAY_FOR(exts, u) {
        if ((exts[u].parent_stmt != substmt) || (exts[u].parent_stmt_index != substmt_index)) {
            return;
        }

        ypr_open(pctx->out, flag);
        if (exts[u].argument) {
            ly_print_(pctx->out, "%*s%s:%s \"", INDENT, exts[u].def->module->name, exts[u].def->name);
            ypr_encode(pctx->out, exts[u].argument, -1);
            ly_print_(pctx->out, "\"");
        } else {
            ly_print_(pctx->out, "%*s%s:%s", INDENT, exts[u].def->module->name, exts[u].def->name);
        }

        LEVEL++;
        inner_flag = 0;
        yprc_extension_instances(pctx, LY_STMT_EXTENSION_INSTANCE, 0, exts[u].exts, &inner_flag);

        if (exts[u].def->plugin && exts[u].def->plugin->sprinter) {
            exts[u].def->plugin->sprinter(&pctx->printer_ctx, &exts[u], &inner_flag);
        }

        LEVEL--;
        ypr_close(pctx, inner_flag);
    }
}

static void
ypr_substmt(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, const char *text, void *exts)
{
    ly_bool extflag = 0;

    if (!text) {
        /* nothing to print */
        return;
    }

    if (stmt_attr_info[substmt].flags & STMT_FLAG_ID) {
        ly_print_(pctx->out, "%*s%s %s", INDENT, stmt_attr_info[substmt].name, text);
    } else {
        ypr_text(pctx, stmt_attr_info[substmt].name, text,
                (stmt_attr_info[substmt].flags & STMT_FLAG_YIN) ? 0 : 1, 0);
    }

    LEVEL++;
    if (pctx->schema == LYS_YPR_PARSED) {
        yprp_extension_instances(pctx, substmt, substmt_index, exts, &extflag);
    } else {
        yprc_extension_instances(pctx, substmt, substmt_index, exts, &extflag);
    }
    LEVEL--;
    ypr_close(pctx, extflag);
}

static void
ypr_unsigned(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts,
        unsigned long int attr_value, ly_bool *flag)
{
    char *str;

    if (asprintf(&str, "%lu", attr_value) == -1) {
        LOGMEM(pctx->module->ctx);
        return;
    }
    ypr_open(pctx->out, flag);
    ypr_substmt(pctx, substmt, substmt_index, str, exts);
    free(str);
}

static void
ypr_signed(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, signed long int attr_value,
        ly_bool *flag)
{
    char *str;

    if (asprintf(&str, "%ld", attr_value) == -1) {
        LOGMEM(pctx->module->ctx);
        return;
    }
    ypr_open(pctx->out, flag);
    ypr_substmt(pctx, substmt, substmt_index, str, exts);
    free(str);
}

static void
yprp_revision(struct lys_ypr_ctx *pctx, const struct lysp_revision *rev)
{
    if (rev->dsc || rev->ref || rev->exts) {
        ly_print_(pctx->out, "%*srevision %s {\n", INDENT, rev->date);
        LEVEL++;
        yprp_extension_instances(pctx, LY_STMT_REVISION, 0, rev->exts, NULL);
        ypr_substmt(pctx, LY_STMT_DESCRIPTION, 0, rev->dsc, rev->exts);
        ypr_substmt(pctx, LY_STMT_REFERENCE, 0, rev->ref, rev->exts);
        LEVEL--;
        ly_print_(pctx->out, "%*s}\n", INDENT);
    } else {
        ly_print_(pctx->out, "%*srevision %s;\n", INDENT, rev->date);
    }
}

static void
ypr_mandatory(struct lys_ypr_ctx *pctx, uint16_t flags, void *exts, ly_bool *flag)
{
    if (flags & LYS_MAND_MASK) {
        ypr_open(pctx->out, flag);
        ypr_substmt(pctx, LY_STMT_MANDATORY, 0, (flags & LYS_MAND_TRUE) ? "true" : "false", exts);
    }
}

static void
ypr_config(struct lys_ypr_ctx *pctx, uint16_t flags, void *exts, ly_bool *flag)
{
    if (flags & LYS_CONFIG_MASK) {
        ypr_open(pctx->out, flag);
        ypr_substmt(pctx, LY_STMT_CONFIG, 0, (flags & LYS_CONFIG_W) ? "true" : "false", exts);
    }
}

static void
ypr_status(struct lys_ypr_ctx *pctx, uint16_t flags, void *exts, ly_bool *flag)
{
    const char *status = NULL;

    if (flags & LYS_STATUS_CURR) {
        ypr_open(pctx->out, flag);
        status = "current";
    } else if (flags & LYS_STATUS_DEPRC) {
        ypr_open(pctx->out, flag);
        status = "deprecated";
    } else if (flags & LYS_STATUS_OBSLT) {
        ypr_open(pctx->out, flag);
        status = "obsolete";
    }

    ypr_substmt(pctx, LY_STMT_STATUS, 0, status, exts);
}

static void
ypr_description(struct lys_ypr_ctx *pctx, const char *dsc, void *exts, ly_bool *flag)
{
    if (dsc) {
        ypr_open(pctx->out, flag);
        ypr_substmt(pctx, LY_STMT_DESCRIPTION, 0, dsc, exts);
    }
}

static void
ypr_reference(struct lys_ypr_ctx *pctx, const char *ref, void *exts, ly_bool *flag)
{
    if (ref) {
        ypr_open(pctx->out, flag);
        ypr_substmt(pctx, LY_STMT_REFERENCE, 0, ref, exts);
    }
}

static void
yprp_iffeatures(struct lys_ypr_ctx *pctx, struct lysp_qname *iffs, struct lysp_ext_instance *exts, ly_bool *flag)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool extflag;

    LY_ARRAY_FOR(iffs, u) {
        ypr_open(pctx->out, flag);
        extflag = 0;

        ly_print_(pctx->out, "%*sif-feature \"%s\"", INDENT, iffs[u].str);

        /* extensions */
        LEVEL++;
        yprp_extension_instances(pctx, LY_STMT_IF_FEATURE, u, exts, &extflag);
        LEVEL--;
        ypr_close(pctx, extflag);
    }
}

static void
yprp_extension(struct lys_ypr_ctx *pctx, const struct lysp_ext *ext)
{
    ly_bool flag = 0, flag2 = 0;
    LY_ARRAY_COUNT_TYPE u;

    ly_print_(pctx->out, "%*sextension %s", INDENT, ext->name);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_EXTENSION, 0, ext->exts, &flag);

    if (ext->argname) {
        ypr_open(pctx->out, &flag);
        ly_print_(pctx->out, "%*sargument %s", INDENT, ext->argname);
        LEVEL++;
        if (ext->exts) {
            u = -1;
            while ((u = lysp_ext_instance_iter(ext->exts, u + 1, LY_STMT_ARGUMENT)) != LY_ARRAY_COUNT(ext->exts)) {
                yprp_extension_instance(pctx, LY_STMT_ARGUMENT, 0, &ext->exts[u], &flag2);
            }
        }
        if ((ext->flags & LYS_YINELEM_MASK) ||
                (ext->exts && (lysp_ext_instance_iter(ext->exts, 0, LY_STMT_YIN_ELEMENT) != LY_ARRAY_COUNT(ext->exts)))) {
            ypr_open(pctx->out, &flag2);
            ypr_substmt(pctx, LY_STMT_YIN_ELEMENT, 0, (ext->flags & LYS_YINELEM_TRUE) ? "true" : "false", ext->exts);
        }
        LEVEL--;
        ypr_close(pctx, flag2);
    }

    ypr_status(pctx, ext->flags, ext->exts, &flag);
    ypr_description(pctx, ext->dsc, ext->exts, &flag);
    ypr_reference(pctx, ext->ref, ext->exts, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_feature(struct lys_ypr_ctx *pctx, const struct lysp_feature *feat)
{
    ly_bool flag = 0;

    ly_print_(pctx->out, "%*sfeature %s", INDENT, feat->name);
    LEVEL++;
    yprp_extension_instances(pctx, LY_STMT_FEATURE, 0, feat->exts, &flag);
    yprp_iffeatures(pctx, feat->iffeatures, feat->exts, &flag);
    ypr_status(pctx, feat->flags, feat->exts, &flag);
    ypr_description(pctx, feat->dsc, feat->exts, &flag);
    ypr_reference(pctx, feat->ref, feat->exts, &flag);
    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_identity(struct lys_ypr_ctx *pctx, const struct lysp_ident *ident)
{
    ly_bool flag = 0;
    LY_ARRAY_COUNT_TYPE u;

    ly_print_(pctx->out, "%*sidentity %s", INDENT, ident->name);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_IDENTITY, 0, ident->exts, &flag);
    yprp_iffeatures(pctx, ident->iffeatures, ident->exts, &flag);

    LY_ARRAY_FOR(ident->bases, u) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_BASE, u, ident->bases[u], ident->exts);
    }

    ypr_status(pctx, ident->flags, ident->exts, &flag);
    ypr_description(pctx, ident->dsc, ident->exts, &flag);
    ypr_reference(pctx, ident->ref, ident->exts, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_identity(struct lys_ypr_ctx *pctx, const struct lysc_ident *ident)
{
    ly_bool flag = 0;
    LY_ARRAY_COUNT_TYPE u;

    ly_print_(pctx->out, "%*sidentity %s", INDENT, ident->name);
    LEVEL++;

    yprc_extension_instances(pctx, LY_STMT_IDENTITY, 0, ident->exts, &flag);

    ypr_open(pctx->out, &flag);
    if (lys_identity_iffeature_value(ident) == LY_ENOT) {
        ly_print_(pctx->out, "%*s/* identity \"%s\" is disabled by if-feature(s) */\n", INDENT, ident->name);
    }

    LY_ARRAY_FOR(ident->derived, u) {
        if (pctx->module != ident->derived[u]->module) {
            ly_print_(pctx->out, "%*sderived %s:%s;\n", INDENT, ident->derived[u]->module->prefix, ident->derived[u]->name);
        } else {
            ly_print_(pctx->out, "%*sderived %s;\n", INDENT, ident->derived[u]->name);
        }
    }

    ypr_status(pctx, ident->flags, ident->exts, &flag);
    ypr_description(pctx, ident->dsc, ident->exts, &flag);
    ypr_reference(pctx, ident->ref, ident->exts, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_restr(struct lys_ypr_ctx *pctx, const struct lysp_restr *restr, enum ly_stmt stmt, ly_bool *flag)
{
    ly_bool inner_flag = 0, singleline;
    const char *text;

    if (!restr) {
        return;
    }

    ypr_open(pctx->out, flag);
    text = ((restr->arg.str[0] != LYSP_RESTR_PATTERN_NACK) && (restr->arg.str[0] != LYSP_RESTR_PATTERN_ACK)) ?
            restr->arg.str : restr->arg.str + 1;
    singleline = strchr(text, '\n') ? 0 : 1;
    ypr_text(pctx, lyplg_ext_stmt2str(stmt), text, singleline, 0);

    LEVEL++;
    yprp_extension_instances(pctx, stmt, 0, restr->exts, &inner_flag);
    if (restr->arg.str[0] == LYSP_RESTR_PATTERN_NACK) {
        /* special byte value in pattern's expression: 0x15 - invert-match, 0x06 - match */
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_MODIFIER, 0, "invert-match", restr->exts);
    }
    if (restr->emsg) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_MESSAGE, 0, restr->emsg, restr->exts);
    }
    if (restr->eapptag) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_APP_TAG, 0, restr->eapptag, restr->exts);
    }
    ypr_description(pctx, restr->dsc, restr->exts, &inner_flag);
    ypr_reference(pctx, restr->ref, restr->exts, &inner_flag);

    LEVEL--;
    ypr_close(pctx, inner_flag);
}

static void
yprc_must(struct lys_ypr_ctx *pctx, const struct lysc_must *must, ly_bool *flag)
{
    ly_bool inner_flag = 0;

    ypr_open(pctx->out, flag);
    ly_print_(pctx->out, "%*smust \"", INDENT);
    ypr_encode(pctx->out, must->cond->expr, -1);
    ly_print_(pctx->out, "\"");

    LEVEL++;
    yprc_extension_instances(pctx, LY_STMT_MUST, 0, must->exts, &inner_flag);
    if (must->emsg) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_MESSAGE, 0, must->emsg, must->exts);
    }
    if (must->eapptag) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_APP_TAG, 0, must->eapptag, must->exts);
    }
    ypr_description(pctx, must->dsc, must->exts, &inner_flag);
    ypr_reference(pctx, must->ref, must->exts, &inner_flag);

    LEVEL--;
    ypr_close(pctx, inner_flag);
}

static void
yprc_range(struct lys_ypr_ctx *pctx, const struct lysc_range *range, LY_DATA_TYPE basetype, ly_bool *flag)
{
    ly_bool inner_flag = 0;
    LY_ARRAY_COUNT_TYPE u;

    if (!range) {
        return;
    }

    ypr_open(pctx->out, flag);
    ly_print_(pctx->out, "%*s%s \"", INDENT, (basetype == LY_TYPE_STRING || basetype == LY_TYPE_BINARY) ? "length" : "range");
    LY_ARRAY_FOR(range->parts, u) {
        if (u > 0) {
            ly_print_(pctx->out, " | ");
        }
        if (range->parts[u].max_64 == range->parts[u].min_64) {
            if (basetype <= LY_TYPE_STRING) { /* unsigned values */
                ly_print_(pctx->out, "%" PRIu64, range->parts[u].max_u64);
            } else { /* signed values */
                ly_print_(pctx->out, "%" PRId64, range->parts[u].max_64);
            }
        } else {
            if (basetype <= LY_TYPE_STRING) { /* unsigned values */
                ly_print_(pctx->out, "%" PRIu64 "..%" PRIu64, range->parts[u].min_u64, range->parts[u].max_u64);
            } else { /* signed values */
                ly_print_(pctx->out, "%" PRId64 "..%" PRId64, range->parts[u].min_64, range->parts[u].max_64);
            }
        }
    }
    ly_print_(pctx->out, "\"");

    LEVEL++;
    yprc_extension_instances(pctx, LY_STMT_RANGE, 0, range->exts, &inner_flag);
    if (range->emsg) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_MESSAGE, 0, range->emsg, range->exts);
    }
    if (range->eapptag) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_APP_TAG, 0, range->eapptag, range->exts);
    }
    ypr_description(pctx, range->dsc, range->exts, &inner_flag);
    ypr_reference(pctx, range->ref, range->exts, &inner_flag);

    LEVEL--;
    ypr_close(pctx, inner_flag);
}

static void
yprc_pattern(struct lys_ypr_ctx *pctx, const struct lysc_pattern *pattern, ly_bool *flag)
{
    ly_bool inner_flag = 0;

    ypr_open(pctx->out, flag);
    ly_print_(pctx->out, "%*spattern \"", INDENT);
    ypr_encode(pctx->out, pattern->expr, -1);
    ly_print_(pctx->out, "\"");

    LEVEL++;
    yprc_extension_instances(pctx, LY_STMT_PATTERN, 0, pattern->exts, &inner_flag);
    if (pattern->inverted) {
        /* special byte value in pattern's expression: 0x15 - invert-match, 0x06 - match */
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_MODIFIER, 0, "invert-match", pattern->exts);
    }
    if (pattern->emsg) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_MESSAGE, 0, pattern->emsg, pattern->exts);
    }
    if (pattern->eapptag) {
        ypr_open(pctx->out, &inner_flag);
        ypr_substmt(pctx, LY_STMT_ERROR_APP_TAG, 0, pattern->eapptag, pattern->exts);
    }
    ypr_description(pctx, pattern->dsc, pattern->exts, &inner_flag);
    ypr_reference(pctx, pattern->ref, pattern->exts, &inner_flag);

    LEVEL--;
    ypr_close(pctx, inner_flag);
}

static void
yprp_when(struct lys_ypr_ctx *pctx, struct lysp_when *when, ly_bool *flag)
{
    ly_bool inner_flag = 0;

    if (!when) {
        return;
    }
    ypr_open(pctx->out, flag);

    ly_print_(pctx->out, "%*swhen \"", INDENT);
    ypr_encode(pctx->out, when->cond, -1);
    ly_print_(pctx->out, "\"");

    LEVEL++;
    yprp_extension_instances(pctx, LY_STMT_WHEN, 0, when->exts, &inner_flag);
    ypr_description(pctx, when->dsc, when->exts, &inner_flag);
    ypr_reference(pctx, when->ref, when->exts, &inner_flag);
    LEVEL--;
    ypr_close(pctx, inner_flag);
}

static void
yprc_when(struct lys_ypr_ctx *pctx, struct lysc_when *when, ly_bool *flag)
{
    ly_bool inner_flag = 0;

    if (!when) {
        return;
    }
    ypr_open(pctx->out, flag);

    ly_print_(pctx->out, "%*swhen \"", INDENT);
    ypr_encode(pctx->out, when->cond->expr, -1);
    ly_print_(pctx->out, "\"");

    LEVEL++;
    yprc_extension_instances(pctx, LY_STMT_WHEN, 0, when->exts, &inner_flag);
    ypr_description(pctx, when->dsc, when->exts, &inner_flag);
    ypr_reference(pctx, when->ref, when->exts, &inner_flag);
    LEVEL--;
    ypr_close(pctx, inner_flag);
}

static void
yprp_enum(struct lys_ypr_ctx *pctx, const struct lysp_type_enum *items, LY_DATA_TYPE type, ly_bool *flag)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool inner_flag;

    LY_ARRAY_FOR(items, u) {
        ypr_open(pctx->out, flag);
        if (type == LY_TYPE_BITS) {
            ly_print_(pctx->out, "%*sbit %s", INDENT, items[u].name);
        } else { /* LY_TYPE_ENUM */
            ly_print_(pctx->out, "%*senum \"", INDENT);
            ypr_encode(pctx->out, items[u].name, -1);
            ly_print_(pctx->out, "\"");
        }
        inner_flag = 0;
        LEVEL++;
        yprp_extension_instances(pctx, LY_STMT_ENUM, 0, items[u].exts, &inner_flag);
        yprp_iffeatures(pctx, items[u].iffeatures, items[u].exts, &inner_flag);
        if (items[u].flags & LYS_SET_VALUE) {
            if (type == LY_TYPE_BITS) {
                ypr_unsigned(pctx, LY_STMT_POSITION, 0, items[u].exts, items[u].value, &inner_flag);
            } else { /* LY_TYPE_ENUM */
                ypr_signed(pctx, LY_STMT_VALUE, 0, items[u].exts, items[u].value, &inner_flag);
            }
        }
        ypr_status(pctx, items[u].flags, items[u].exts, &inner_flag);
        ypr_description(pctx, items[u].dsc, items[u].exts, &inner_flag);
        ypr_reference(pctx, items[u].ref, items[u].exts, &inner_flag);
        LEVEL--;
        ypr_close(pctx, inner_flag);
    }
}

static void
yprp_type(struct lys_ypr_ctx *pctx, const struct lysp_type *type)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;

    ly_print_(pctx->out, "%*stype %s", INDENT, type->name);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_TYPE, 0, type->exts, &flag);

    yprp_restr(pctx, type->range, LY_STMT_RANGE, &flag);
    yprp_restr(pctx, type->length, LY_STMT_LENGTH, &flag);
    LY_ARRAY_FOR(type->patterns, u) {
        yprp_restr(pctx, &type->patterns[u], LY_STMT_PATTERN, &flag);
    }
    yprp_enum(pctx, type->bits, LY_TYPE_BITS, &flag);
    yprp_enum(pctx, type->enums, LY_TYPE_ENUM, &flag);

    if (type->path) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_PATH, 0, type->path->expr, type->exts);
    }
    if (type->flags & LYS_SET_REQINST) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_REQUIRE_INSTANCE, 0, type->require_instance ? "true" : "false", type->exts);
    }
    if (type->flags & LYS_SET_FRDIGITS) {
        ypr_unsigned(pctx, LY_STMT_FRACTION_DIGITS, 0, type->exts, type->fraction_digits, &flag);
    }
    LY_ARRAY_FOR(type->bases, u) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_BASE, u, type->bases[u], type->exts);
    }
    LY_ARRAY_FOR(type->types, u) {
        ypr_open(pctx->out, &flag);
        yprp_type(pctx, &type->types[u]);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_dflt_value(struct lys_ypr_ctx *pctx, const struct ly_ctx *ly_pctx, const struct lyd_value *value,
        struct lysc_ext_instance *exts)
{
    ly_bool dynamic;
    const char *str;

    str = value->realtype->plugin->print(ly_pctx, value, LY_VALUE_JSON, NULL, &dynamic, NULL);
    ypr_substmt(pctx, LY_STMT_DEFAULT, 0, str, exts);
    if (dynamic) {
        free((void *)str);
    }
}

static void
yprc_type(struct lys_ypr_ctx *pctx, const struct lysc_type *type)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;

    ly_print_(pctx->out, "%*stype %s", INDENT, lys_datatype2str(type->basetype));
    LEVEL++;

    yprc_extension_instances(pctx, LY_STMT_TYPE, 0, type->exts, &flag);

    switch (type->basetype) {
    case LY_TYPE_BINARY: {
        struct lysc_type_bin *bin = (struct lysc_type_bin *)type;

        yprc_range(pctx, bin->length, type->basetype, &flag);
        break;
    }
    case LY_TYPE_UINT8:
    case LY_TYPE_UINT16:
    case LY_TYPE_UINT32:
    case LY_TYPE_UINT64:
    case LY_TYPE_INT8:
    case LY_TYPE_INT16:
    case LY_TYPE_INT32:
    case LY_TYPE_INT64: {
        struct lysc_type_num *num = (struct lysc_type_num *)type;

        yprc_range(pctx, num->range, type->basetype, &flag);
        break;
    }
    case LY_TYPE_STRING: {
        struct lysc_type_str *str = (struct lysc_type_str *)type;

        yprc_range(pctx, str->length, type->basetype, &flag);
        LY_ARRAY_FOR(str->patterns, u) {
            yprc_pattern(pctx, str->patterns[u], &flag);
        }
        break;
    }
    case LY_TYPE_BITS:
    case LY_TYPE_ENUM: {
        /* bits and enums structures are compatible */
        struct lysc_type_bits *bits = (struct lysc_type_bits *)type;

        LY_ARRAY_FOR(bits->bits, u) {
            struct lysc_type_bitenum_item *item = &bits->bits[u];
            ly_bool inner_flag = 0;

            ypr_open(pctx->out, &flag);
            ly_print_(pctx->out, "%*s%s \"", INDENT, type->basetype == LY_TYPE_BITS ? "bit" : "enum");
            ypr_encode(pctx->out, item->name, -1);
            ly_print_(pctx->out, "\"");
            LEVEL++;
            if (type->basetype == LY_TYPE_BITS) {
                yprc_extension_instances(pctx, LY_STMT_BIT, 0, item->exts, &inner_flag);
                ypr_unsigned(pctx, LY_STMT_POSITION, 0, item->exts, item->position, &inner_flag);
            } else { /* LY_TYPE_ENUM */
                yprc_extension_instances(pctx, LY_STMT_ENUM, 0, item->exts, &inner_flag);
                ypr_signed(pctx, LY_STMT_VALUE, 0, item->exts, item->value, &inner_flag);
            }
            ypr_status(pctx, item->flags, item->exts, &inner_flag);
            ypr_description(pctx, item->dsc, item->exts, &inner_flag);
            ypr_reference(pctx, item->ref, item->exts, &inner_flag);
            LEVEL--;
            ypr_close(pctx, inner_flag);
        }
        break;
    }
    case LY_TYPE_BOOL:
    case LY_TYPE_EMPTY:
        /* nothing to do */
        break;
    case LY_TYPE_DEC64: {
        struct lysc_type_dec *dec = (struct lysc_type_dec *)type;

        ypr_open(pctx->out, &flag);
        ypr_unsigned(pctx, LY_STMT_FRACTION_DIGITS, 0, type->exts, dec->fraction_digits, &flag);
        yprc_range(pctx, dec->range, dec->basetype, &flag);
        break;
    }
    case LY_TYPE_IDENT: {
        struct lysc_type_identityref *ident = (struct lysc_type_identityref *)type;

        LY_ARRAY_FOR(ident->bases, u) {
            ypr_open(pctx->out, &flag);
            ypr_substmt(pctx, LY_STMT_BASE, u, ident->bases[u]->name, type->exts);
        }
        break;
    }
    case LY_TYPE_INST: {
        struct lysc_type_instanceid *inst = (struct lysc_type_instanceid *)type;

        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_REQUIRE_INSTANCE, 0, inst->require_instance ? "true" : "false", inst->exts);
        break;
    }
    case LY_TYPE_LEAFREF: {
        struct lysc_type_leafref *lr = (struct lysc_type_leafref *)type;

        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_PATH, 0, lr->path->expr, lr->exts);
        ypr_substmt(pctx, LY_STMT_REQUIRE_INSTANCE, 0, lr->require_instance ? "true" : "false", lr->exts);
        yprc_type(pctx, lr->realtype);
        break;
    }
    case LY_TYPE_UNION: {
        struct lysc_type_union *un = (struct lysc_type_union *)type;

        LY_ARRAY_FOR(un->types, u) {
            ypr_open(pctx->out, &flag);
            yprc_type(pctx, un->types[u]);
        }
        break;
    }
    default:
        LOGINT(pctx->module->ctx);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_typedef(struct lys_ypr_ctx *pctx, const struct lysp_tpdf *tpdf)
{
    ly_print_(pctx->out, "%*stypedef %s {\n", INDENT, tpdf->name);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_TYPEDEF, 0, tpdf->exts, NULL);

    yprp_type(pctx, &tpdf->type);

    if (tpdf->units) {
        ypr_substmt(pctx, LY_STMT_UNITS, 0, tpdf->units, tpdf->exts);
    }
    if (tpdf->dflt.str) {
        ypr_substmt(pctx, LY_STMT_DEFAULT, 0, tpdf->dflt.str, tpdf->exts);
    }

    ypr_status(pctx, tpdf->flags, tpdf->exts, NULL);
    ypr_description(pctx, tpdf->dsc, tpdf->exts, NULL);
    ypr_reference(pctx, tpdf->ref, tpdf->exts, NULL);

    LEVEL--;
    ly_print_(pctx->out, "%*s}\n", INDENT);
}

static void yprp_node(struct lys_ypr_ctx *pctx, const struct lysp_node *node);
static void yprc_node(struct lys_ypr_ctx *pctx, const struct lysc_node *node);
static void yprp_action(struct lys_ypr_ctx *pctx, const struct lysp_node_action *action);
static void yprp_notification(struct lys_ypr_ctx *pctx, const struct lysp_node_notif *notif);

static void
yprp_grouping(struct lys_ypr_ctx *pctx, const struct lysp_node_grp *grp)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysp_node *data;
    struct lysp_node_action *action;
    struct lysp_node_notif *notif;
    struct lysp_node_grp *subgrp;

    ly_print_(pctx->out, "%*sgrouping %s", INDENT, grp->name);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_GROUPING, 0, grp->exts, &flag);
    ypr_status(pctx, grp->flags, grp->exts, &flag);
    ypr_description(pctx, grp->dsc, grp->exts, &flag);
    ypr_reference(pctx, grp->ref, grp->exts, &flag);

    LY_ARRAY_FOR(grp->typedefs, u) {
        ypr_open(pctx->out, &flag);
        yprp_typedef(pctx, &grp->typedefs[u]);
    }

    LY_LIST_FOR(grp->groupings, subgrp) {
        ypr_open(pctx->out, &flag);
        yprp_grouping(pctx, subgrp);
    }

    LY_LIST_FOR(grp->child, data) {
        ypr_open(pctx->out, &flag);
        yprp_node(pctx, data);
    }

    LY_LIST_FOR(grp->actions, action) {
        ypr_open(pctx->out, &flag);
        yprp_action(pctx, action);
    }

    LY_LIST_FOR(grp->notifs, notif) {
        ypr_open(pctx->out, &flag);
        yprp_notification(pctx, notif);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_inout(struct lys_ypr_ctx *pctx, const struct lysp_node_action_inout *inout, ly_bool *flag)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysp_node *data;
    struct lysp_node_grp *grp;

    if (!inout->child) {
        /* no children */
        return;
    }
    ypr_open(pctx->out, flag);
    YPR_EXTRA_LINE_PRINT(pctx);

    ly_print_(pctx->out, "%*s%s {\n", INDENT, inout->name);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_MUST, 0, inout->exts, NULL);
    LY_ARRAY_FOR(inout->musts, u) {
        yprp_restr(pctx, &inout->musts[u], LY_STMT_MUST, NULL);
    }
    LY_ARRAY_FOR(inout->typedefs, u) {
        yprp_typedef(pctx, &inout->typedefs[u]);
    }
    LY_LIST_FOR(inout->groupings, grp) {
        yprp_grouping(pctx, grp);
    }

    LY_LIST_FOR(inout->child, data) {
        yprp_node(pctx, data);
    }

    LEVEL--;
    ypr_close(pctx, 1);
}

static void
yprc_inout(struct lys_ypr_ctx *pctx, const struct lysc_node_action_inout *inout, ly_bool *flag)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysc_node *data;

    if (!inout->child) {
        /* input/output is empty */
        return;
    }
    ypr_open(pctx->out, flag);

    ly_print_(pctx->out, "\n%*s%s {\n", INDENT, inout->name);
    LEVEL++;

    yprc_extension_instances(pctx, lyplg_ext_nodetype2stmt(inout->nodetype), 0, inout->exts, NULL);
    LY_ARRAY_FOR(inout->musts, u) {
        yprc_must(pctx, &inout->musts[u], NULL);
    }

    if (!(pctx->options & LYS_PRINT_NO_SUBSTMT)) {
        LY_LIST_FOR(inout->child, data) {
            yprc_node(pctx, data);
        }
    }

    LEVEL--;
    ypr_close(pctx, 1);
}

static void
yprp_notification(struct lys_ypr_ctx *pctx, const struct lysp_node_notif *notif)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysp_node *data;
    struct lysp_node_grp *grp;

    ly_print_(pctx->out, "%*snotification %s", INDENT, notif->name);

    LEVEL++;
    yprp_extension_instances(pctx, LY_STMT_NOTIFICATION, 0, notif->exts, &flag);
    yprp_iffeatures(pctx, notif->iffeatures, notif->exts, &flag);

    LY_ARRAY_FOR(notif->musts, u) {
        yprp_restr(pctx, &notif->musts[u], LY_STMT_MUST, &flag);
    }
    ypr_status(pctx, notif->flags, notif->exts, &flag);
    ypr_description(pctx, notif->dsc, notif->exts, &flag);
    ypr_reference(pctx, notif->ref, notif->exts, &flag);

    LY_ARRAY_FOR(notif->typedefs, u) {
        ypr_open(pctx->out, &flag);
        yprp_typedef(pctx, &notif->typedefs[u]);
    }

    LY_LIST_FOR(notif->groupings, grp) {
        ypr_open(pctx->out, &flag);
        yprp_grouping(pctx, grp);
    }

    LY_LIST_FOR(notif->child, data) {
        ypr_open(pctx->out, &flag);
        yprp_node(pctx, data);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_notification(struct lys_ypr_ctx *pctx, const struct lysc_node_notif *notif)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysc_node *data;

    ly_print_(pctx->out, "%*snotification %s", INDENT, notif->name);

    LEVEL++;
    yprc_extension_instances(pctx, LY_STMT_NOTIFICATION, 0, notif->exts, &flag);

    LY_ARRAY_FOR(notif->musts, u) {
        yprc_must(pctx, &notif->musts[u], &flag);
    }
    ypr_status(pctx, notif->flags, notif->exts, &flag);
    ypr_description(pctx, notif->dsc, notif->exts, &flag);
    ypr_reference(pctx, notif->ref, notif->exts, &flag);

    if (!(pctx->options & LYS_PRINT_NO_SUBSTMT)) {
        LY_LIST_FOR(notif->child, data) {
            ypr_open(pctx->out, &flag);
            yprc_node(pctx, data);
        }
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_action(struct lys_ypr_ctx *pctx, const struct lysp_node_action *action)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysp_node_grp *grp;

    ly_print_(pctx->out, "%*s%s %s", INDENT, action->parent ? "action" : "rpc", action->name);

    LEVEL++;
    yprp_extension_instances(pctx, lyplg_ext_nodetype2stmt(action->nodetype), 0, action->exts, &flag);
    yprp_iffeatures(pctx, action->iffeatures, action->exts, &flag);
    ypr_status(pctx, action->flags, action->exts, &flag);
    ypr_description(pctx, action->dsc, action->exts, &flag);
    ypr_reference(pctx, action->ref, action->exts, &flag);

    YPR_EXTRA_LINE(flag, pctx);

    LY_ARRAY_FOR(action->typedefs, u) {
        ypr_open(pctx->out, &flag);
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_typedef(pctx, &action->typedefs[u]);
    }

    YPR_EXTRA_LINE(action->typedefs, pctx);

    LY_LIST_FOR(action->groupings, grp) {
        ypr_open(pctx->out, &flag);
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_grouping(pctx, grp);
    }

    YPR_EXTRA_LINE(action->groupings, pctx);

    yprp_inout(pctx, &action->input, &flag);
    yprp_inout(pctx, &action->output, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_action(struct lys_ypr_ctx *pctx, const struct lysc_node_action *action)
{
    ly_bool flag = 0;

    ly_print_(pctx->out, "%*s%s %s", INDENT, action->parent ? "action" : "rpc", action->name);

    LEVEL++;
    yprc_extension_instances(pctx, lyplg_ext_nodetype2stmt(action->nodetype), 0, action->exts, &flag);
    ypr_status(pctx, action->flags, action->exts, &flag);
    ypr_description(pctx, action->dsc, action->exts, &flag);
    ypr_reference(pctx, action->ref, action->exts, &flag);

    yprc_inout(pctx, &action->input, &flag);
    yprc_inout(pctx, &action->output, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_node_common1(struct lys_ypr_ctx *pctx, const struct lysp_node *node, ly_bool *flag)
{
    ly_print_(pctx->out, "%*s%s %s%s", INDENT, lys_nodetype2str(node->nodetype), node->name, flag ? "" : " {\n");
    LEVEL++;

    yprp_extension_instances(pctx, lyplg_ext_nodetype2stmt(node->nodetype), 0, node->exts, flag);
    yprp_when(pctx, lysp_node_when(node), flag);
    yprp_iffeatures(pctx, node->iffeatures, node->exts, flag);
}

static void
yprc_node_common1(struct lys_ypr_ctx *pctx, const struct lysc_node *node, ly_bool *flag)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysc_when **when;

    ly_print_(pctx->out, "%*s%s %s%s", INDENT, lys_nodetype2str(node->nodetype), node->name, flag ? "" : " {\n");
    LEVEL++;

    yprc_extension_instances(pctx, lyplg_ext_nodetype2stmt(node->nodetype), 0, node->exts, flag);

    when = lysc_node_when(node);
    LY_ARRAY_FOR(when, u) {
        yprc_when(pctx, when[u], flag);
    }
}

/* macro to unify the code */
#define YPR_NODE_COMMON2 \
    ypr_config(pctx, node->flags, node->exts, flag); \
    if (node->nodetype & (LYS_CHOICE | LYS_LEAF | LYS_ANYDATA)) { \
        ypr_mandatory(pctx, node->flags, node->exts, flag); \
    } \
    ypr_status(pctx, node->flags, node->exts, flag); \
    ypr_description(pctx, node->dsc, node->exts, flag); \
    ypr_reference(pctx, node->ref, node->exts, flag)

static void
yprp_node_common2(struct lys_ypr_ctx *pctx, const struct lysp_node *node, ly_bool *flag)
{
    YPR_NODE_COMMON2;
}

static void
yprc_node_common2(struct lys_ypr_ctx *pctx, const struct lysc_node *node, ly_bool *flag)
{
    YPR_NODE_COMMON2;
}

#undef YPR_NODE_COMMON2

static void
yprp_container(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysp_node *child;
    struct lysp_node_action *action;
    struct lysp_node_notif *notif;
    struct lysp_node_grp *grp;
    struct lysp_node_container *cont = (struct lysp_node_container *)node;

    yprp_node_common1(pctx, node, &flag);

    LY_ARRAY_FOR(cont->musts, u) {
        yprp_restr(pctx, &cont->musts[u], LY_STMT_MUST, &flag);
    }
    if (cont->presence) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_PRESENCE, 0, cont->presence, cont->exts);
    }

    yprp_node_common2(pctx, node, &flag);

    LY_ARRAY_FOR(cont->typedefs, u) {
        ypr_open(pctx->out, &flag);
        yprp_typedef(pctx, &cont->typedefs[u]);
    }

    LY_LIST_FOR(cont->groupings, grp) {
        ypr_open(pctx->out, &flag);
        yprp_grouping(pctx, grp);
    }

    LY_LIST_FOR(cont->child, child) {
        ypr_open(pctx->out, &flag);
        yprp_node(pctx, child);
    }

    LY_LIST_FOR(cont->actions, action) {
        ypr_open(pctx->out, &flag);
        yprp_action(pctx, action);
    }

    LY_LIST_FOR(cont->notifs, notif) {
        ypr_open(pctx->out, &flag);
        yprp_notification(pctx, notif);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_container(struct lys_ypr_ctx *pctx, const struct lysc_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysc_node *child;
    struct lysc_node_action *action;
    struct lysc_node_notif *notif;
    struct lysc_node_container *cont = (struct lysc_node_container *)node;

    yprc_node_common1(pctx, node, &flag);

    LY_ARRAY_FOR(cont->musts, u) {
        yprc_must(pctx, &cont->musts[u], &flag);
    }
    if (cont->flags & LYS_PRESENCE) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_PRESENCE, 0, "true", cont->exts);
    }

    yprc_node_common2(pctx, node, &flag);

    if (!(pctx->options & LYS_PRINT_NO_SUBSTMT)) {
        LY_LIST_FOR(cont->child, child) {
            ypr_open(pctx->out, &flag);
            yprc_node(pctx, child);
        }

        LY_LIST_FOR(cont->actions, action) {
            ypr_open(pctx->out, &flag);
            yprc_action(pctx, action);
        }

        LY_LIST_FOR(cont->notifs, notif) {
            ypr_open(pctx->out, &flag);
            yprc_notification(pctx, notif);
        }
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_case(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    ly_bool flag = 0;
    struct lysp_node *child;
    struct lysp_node_case *cas = (struct lysp_node_case *)node;

    yprp_node_common1(pctx, node, &flag);
    yprp_node_common2(pctx, node, &flag);

    LY_LIST_FOR(cas->child, child) {
        ypr_open(pctx->out, &flag);
        yprp_node(pctx, child);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_case(struct lys_ypr_ctx *pctx, const struct lysc_node_case *cs)
{
    ly_bool flag = 0;
    struct lysc_node *child;

    yprc_node_common1(pctx, &cs->node, &flag);
    yprc_node_common2(pctx, &cs->node, &flag);

    if (!(pctx->options & LYS_PRINT_NO_SUBSTMT)) {
        for (child = cs->child; child && child->parent == (struct lysc_node *)cs; child = child->next) {
            ypr_open(pctx->out, &flag);
            yprc_node(pctx, child);
        }
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_choice(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    ly_bool flag = 0;
    struct lysp_node *child;
    struct lysp_node_choice *choice = (struct lysp_node_choice *)node;

    yprp_node_common1(pctx, node, &flag);

    if (choice->dflt.str) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_DEFAULT, 0, choice->dflt.str, choice->exts);
    }

    yprp_node_common2(pctx, node, &flag);

    LY_LIST_FOR(choice->child, child) {
        ypr_open(pctx->out, &flag);
        yprp_node(pctx, child);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_choice(struct lys_ypr_ctx *pctx, const struct lysc_node *node)
{
    ly_bool flag = 0;
    struct lysc_node_case *cs;
    struct lysc_node_choice *choice = (struct lysc_node_choice *)node;

    yprc_node_common1(pctx, node, &flag);

    if (choice->dflt) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_DEFAULT, 0, choice->dflt->name, choice->exts);
    }

    yprc_node_common2(pctx, node, &flag);

    for (cs = choice->cases; cs; cs = (struct lysc_node_case *)cs->next) {
        ypr_open(pctx->out, &flag);
        yprc_case(pctx, cs);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_leaf(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysp_node_leaf *leaf = (struct lysp_node_leaf *)node;

    yprp_node_common1(pctx, node, NULL);

    yprp_type(pctx, &leaf->type);
    ypr_substmt(pctx, LY_STMT_UNITS, 0, leaf->units, leaf->exts);
    LY_ARRAY_FOR(leaf->musts, u) {
        yprp_restr(pctx, &leaf->musts[u], LY_STMT_MUST, NULL);
    }
    ypr_substmt(pctx, LY_STMT_DEFAULT, 0, leaf->dflt.str, leaf->exts);

    yprp_node_common2(pctx, node, NULL);

    LEVEL--;
    ly_print_(pctx->out, "%*s}\n", INDENT);
}

static void
yprc_leaf(struct lys_ypr_ctx *pctx, const struct lysc_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysc_node_leaf *leaf = (struct lysc_node_leaf *)node;

    yprc_node_common1(pctx, node, NULL);

    yprc_type(pctx, leaf->type);
    ypr_substmt(pctx, LY_STMT_UNITS, 0, leaf->units, leaf->exts);
    LY_ARRAY_FOR(leaf->musts, u) {
        yprc_must(pctx, &leaf->musts[u], NULL);
    }

    if (leaf->dflt) {
        yprc_dflt_value(pctx, node->module->ctx, leaf->dflt, leaf->exts);
    }

    yprc_node_common2(pctx, node, NULL);

    LEVEL--;
    ly_print_(pctx->out, "%*s}\n", INDENT);
}

static void
yprp_leaflist(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysp_node_leaflist *llist = (struct lysp_node_leaflist *)node;

    yprp_node_common1(pctx, node, NULL);

    yprp_type(pctx, &llist->type);
    ypr_substmt(pctx, LY_STMT_UNITS, 0, llist->units, llist->exts);
    LY_ARRAY_FOR(llist->musts, u) {
        yprp_restr(pctx, &llist->musts[u], LY_STMT_MUST, NULL);
    }
    LY_ARRAY_FOR(llist->dflts, u) {
        ypr_substmt(pctx, LY_STMT_DEFAULT, u, llist->dflts[u].str, llist->exts);
    }

    ypr_config(pctx, node->flags, node->exts, NULL);

    if (llist->flags & LYS_SET_MIN) {
        ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, llist->exts, llist->min, NULL);
    }
    if (llist->flags & LYS_SET_MAX) {
        if (llist->max) {
            ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, llist->exts, llist->max, NULL);
        } else {
            ypr_substmt(pctx, LY_STMT_MAX_ELEMENTS, 0, "unbounded", llist->exts);
        }
    }

    if (llist->flags & LYS_ORDBY_MASK) {
        ypr_substmt(pctx, LY_STMT_ORDERED_BY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);
    }

    ypr_status(pctx, node->flags, node->exts, NULL);
    ypr_description(pctx, node->dsc, node->exts, NULL);
    ypr_reference(pctx, node->ref, node->exts, NULL);

    LEVEL--;
    ly_print_(pctx->out, "%*s}\n", INDENT);
}

static void
yprc_leaflist(struct lys_ypr_ctx *pctx, const struct lysc_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysc_node_leaflist *llist = (struct lysc_node_leaflist *)node;

    yprc_node_common1(pctx, node, NULL);

    yprc_type(pctx, llist->type);
    ypr_substmt(pctx, LY_STMT_UNITS, 0, llist->units, llist->exts);
    LY_ARRAY_FOR(llist->musts, u) {
        yprc_must(pctx, &llist->musts[u], NULL);
    }
    LY_ARRAY_FOR(llist->dflts, u) {
        yprc_dflt_value(pctx, node->module->ctx, llist->dflts[u], llist->exts);
    }

    ypr_config(pctx, node->flags, node->exts, NULL);

    ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, llist->exts, llist->min, NULL);
    if (llist->max) {
        ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, llist->exts, llist->max, NULL);
    } else {
        ypr_substmt(pctx, LY_STMT_MAX_ELEMENTS, 0, "unbounded", llist->exts);
    }

    ypr_substmt(pctx, LY_STMT_ORDERED_BY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);

    ypr_status(pctx, node->flags, node->exts, NULL);
    ypr_description(pctx, node->dsc, node->exts, NULL);
    ypr_reference(pctx, node->ref, node->exts, NULL);

    LEVEL--;
    ly_print_(pctx->out, "%*s}\n", INDENT);
}

static void
yprp_list(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysp_node *child;
    struct lysp_node_action *action;
    struct lysp_node_notif *notif;
    struct lysp_node_grp *grp;
    struct lysp_node_list *list = (struct lysp_node_list *)node;

    yprp_node_common1(pctx, node, &flag);

    LY_ARRAY_FOR(list->musts, u) {
        yprp_restr(pctx, &list->musts[u], LY_STMT_MUST, &flag);
    }
    if (list->key) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_KEY, 0, list->key, list->exts);
    }
    LY_ARRAY_FOR(list->uniques, u) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_UNIQUE, u, list->uniques[u].str, list->exts);
    }

    ypr_config(pctx, node->flags, node->exts, &flag);

    if (list->flags & LYS_SET_MIN) {
        ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, list->exts, list->min, &flag);
    }
    if (list->flags & LYS_SET_MAX) {
        if (list->max) {
            ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, list->exts, list->max, &flag);
        } else {
            ypr_open(pctx->out, &flag);
            ypr_substmt(pctx, LY_STMT_MAX_ELEMENTS, 0, "unbounded", list->exts);
        }
    }

    if (list->flags & LYS_ORDBY_MASK) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_ORDERED_BY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);
    }

    ypr_status(pctx, node->flags, node->exts, &flag);
    ypr_description(pctx, node->dsc, node->exts, &flag);
    ypr_reference(pctx, node->ref, node->exts, &flag);

    LY_ARRAY_FOR(list->typedefs, u) {
        ypr_open(pctx->out, &flag);
        yprp_typedef(pctx, &list->typedefs[u]);
    }

    LY_LIST_FOR(list->groupings, grp) {
        ypr_open(pctx->out, &flag);
        yprp_grouping(pctx, grp);
    }

    LY_LIST_FOR(list->child, child) {
        ypr_open(pctx->out, &flag);
        yprp_node(pctx, child);
    }

    LY_LIST_FOR(list->actions, action) {
        ypr_open(pctx->out, &flag);
        yprp_action(pctx, action);
    }

    LY_LIST_FOR(list->notifs, notif) {
        ypr_open(pctx->out, &flag);
        yprp_notification(pctx, notif);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_list(struct lys_ypr_ctx *pctx, const struct lysc_node *node)
{
    LY_ARRAY_COUNT_TYPE u, v;
    struct lysc_node_list *list = (struct lysc_node_list *)node;

    yprc_node_common1(pctx, node, NULL);

    LY_ARRAY_FOR(list->musts, u) {
        yprc_must(pctx, &list->musts[u], NULL);
    }
    if (!(list->flags & LYS_KEYLESS)) {
        ly_print_(pctx->out, "%*skey \"", INDENT);
        for (struct lysc_node *key = list->child; key && key->nodetype == LYS_LEAF && (key->flags & LYS_KEY); key = key->next) {
            ly_print_(pctx->out, "%s%s", u > 0 ? ", " : "", key->name);
        }
        ly_print_(pctx->out, "\";\n");
    }
    LY_ARRAY_FOR(list->uniques, u) {
        ly_print_(pctx->out, "%*sunique \"", INDENT);
        LY_ARRAY_FOR(list->uniques[u], v) {
            ly_print_(pctx->out, "%s%s", v > 0 ? ", " : "", list->uniques[u][v]->name);
        }
        ypr_close(pctx, 0);
    }

    ypr_config(pctx, node->flags, node->exts, NULL);

    ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, list->exts, list->min, NULL);
    if (list->max) {
        ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, list->exts, list->max, NULL);
    } else {
        ypr_substmt(pctx, LY_STMT_MAX_ELEMENTS, 0, "unbounded", list->exts);
    }

    ypr_substmt(pctx, LY_STMT_ORDERED_BY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);

    ypr_status(pctx, node->flags, node->exts, NULL);
    ypr_description(pctx, node->dsc, node->exts, NULL);
    ypr_reference(pctx, node->ref, node->exts, NULL);

    if (!(pctx->options & LYS_PRINT_NO_SUBSTMT)) {
        struct lysc_node *child;
        struct lysc_node_action *action;
        struct lysc_node_notif *notif;

        LY_LIST_FOR(list->child, child) {
            yprc_node(pctx, child);
        }

        LY_LIST_FOR(list->actions, action) {
            yprc_action(pctx, action);
        }

        LY_LIST_FOR(list->notifs, notif) {
            yprc_notification(pctx, notif);
        }
    }

    LEVEL--;
    ypr_close(pctx, 1);
}

static void
yprp_refine(struct lys_ypr_ctx *pctx, struct lysp_refine *refine)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;

    ly_print_(pctx->out, "%*srefine \"%s\"", INDENT, refine->nodeid);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_REFINE, 0, refine->exts, &flag);
    yprp_iffeatures(pctx, refine->iffeatures, refine->exts, &flag);

    LY_ARRAY_FOR(refine->musts, u) {
        ypr_open(pctx->out, &flag);
        yprp_restr(pctx, &refine->musts[u], LY_STMT_MUST, NULL);
    }

    if (refine->presence) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_PRESENCE, 0, refine->presence, refine->exts);
    }

    LY_ARRAY_FOR(refine->dflts, u) {
        ypr_open(pctx->out, &flag);
        ypr_substmt(pctx, LY_STMT_DEFAULT, u, refine->dflts[u].str, refine->exts);
    }

    ypr_config(pctx, refine->flags, refine->exts, &flag);
    ypr_mandatory(pctx, refine->flags, refine->exts, &flag);

    if (refine->flags & LYS_SET_MIN) {
        ypr_open(pctx->out, &flag);
        ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, refine->exts, refine->min, NULL);
    }
    if (refine->flags & LYS_SET_MAX) {
        ypr_open(pctx->out, &flag);
        if (refine->max) {
            ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, refine->exts, refine->max, NULL);
        } else {
            ypr_substmt(pctx, LY_STMT_MAX_ELEMENTS, 0, "unbounded", refine->exts);
        }
    }

    ypr_description(pctx, refine->dsc, refine->exts, &flag);
    ypr_reference(pctx, refine->ref, refine->exts, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_augment(struct lys_ypr_ctx *pctx, const struct lysp_node_augment *aug)
{
    struct lysp_node *child;
    struct lysp_node_action *action;
    struct lysp_node_notif *notif;

    ly_print_(pctx->out, "%*saugment \"%s\" {\n", INDENT, aug->nodeid);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_AUGMENT, 0, aug->exts, NULL);
    yprp_when(pctx, aug->when, NULL);
    yprp_iffeatures(pctx, aug->iffeatures, aug->exts, NULL);
    ypr_status(pctx, aug->flags, aug->exts, NULL);
    ypr_description(pctx, aug->dsc, aug->exts, NULL);
    ypr_reference(pctx, aug->ref, aug->exts, NULL);

    LY_LIST_FOR(aug->child, child) {
        yprp_node(pctx, child);
    }

    LY_LIST_FOR(aug->actions, action) {
        yprp_action(pctx, action);
    }

    LY_LIST_FOR(aug->notifs, notif) {
        yprp_notification(pctx, notif);
    }

    LEVEL--;
    ypr_close(pctx, 1);
}

static void
yprp_uses(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysp_node_uses *uses = (struct lysp_node_uses *)node;
    struct lysp_node_augment *aug;

    yprp_node_common1(pctx, node, &flag);
    yprp_node_common2(pctx, node, &flag);

    LY_ARRAY_FOR(uses->refines, u) {
        ypr_open(pctx->out, &flag);
        yprp_refine(pctx, &uses->refines[u]);
    }

    LY_LIST_FOR(uses->augments, aug) {
        ypr_open(pctx->out, &flag);
        yprp_augment(pctx, aug);
    }

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_anydata(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysp_node_anydata *any = (struct lysp_node_anydata *)node;

    yprp_node_common1(pctx, node, &flag);

    LY_ARRAY_FOR(any->musts, u) {
        ypr_open(pctx->out, &flag);
        yprp_restr(pctx, &any->musts[u], LY_STMT_MUST, NULL);
    }

    yprp_node_common2(pctx, node, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprc_anydata(struct lys_ypr_ctx *pctx, const struct lysc_node *node)
{
    LY_ARRAY_COUNT_TYPE u;
    ly_bool flag = 0;
    struct lysc_node_anydata *any = (struct lysc_node_anydata *)node;

    yprc_node_common1(pctx, node, &flag);

    LY_ARRAY_FOR(any->musts, u) {
        ypr_open(pctx->out, &flag);
        yprc_must(pctx, &any->musts[u], NULL);
    }

    yprc_node_common2(pctx, node, &flag);

    LEVEL--;
    ypr_close(pctx, flag);
}

static void
yprp_node(struct lys_ypr_ctx *pctx, const struct lysp_node *node)
{
    switch (node->nodetype) {
    case LYS_CONTAINER:
        yprp_container(pctx, node);
        break;
    case LYS_CHOICE:
        yprp_choice(pctx, node);
        break;
    case LYS_LEAF:
        yprp_leaf(pctx, node);
        break;
    case LYS_LEAFLIST:
        yprp_leaflist(pctx, node);
        break;
    case LYS_LIST:
        yprp_list(pctx, node);
        break;
    case LYS_USES:
        yprp_uses(pctx, node);
        break;
    case LYS_ANYXML:
    case LYS_ANYDATA:
        yprp_anydata(pctx, node);
        break;
    case LYS_CASE:
        yprp_case(pctx, node);
        break;
    default:
        break;
    }
}

static void
yprc_node(struct lys_ypr_ctx *pctx, const struct lysc_node *node)
{
    switch (node->nodetype) {
    case LYS_CONTAINER:
        yprc_container(pctx, node);
        break;
    case LYS_CHOICE:
        yprc_choice(pctx, node);
        break;
    case LYS_LEAF:
        yprc_leaf(pctx, node);
        break;
    case LYS_LEAFLIST:
        yprc_leaflist(pctx, node);
        break;
    case LYS_LIST:
        yprc_list(pctx, node);
        break;
    case LYS_ANYXML:
    case LYS_ANYDATA:
        yprc_anydata(pctx, node);
        break;
    default:
        break;
    }
}

static void
yprp_deviation(struct lys_ypr_ctx *pctx, const struct lysp_deviation *deviation)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysp_deviate_add *add;
    struct lysp_deviate_rpl *rpl;
    struct lysp_deviate_del *del;
    struct lysp_deviate *elem;

    ly_print_(pctx->out, "%*sdeviation \"%s\" {\n", INDENT, deviation->nodeid);
    LEVEL++;

    yprp_extension_instances(pctx, LY_STMT_DEVIATION, 0, deviation->exts, NULL);
    ypr_description(pctx, deviation->dsc, deviation->exts, NULL);
    ypr_reference(pctx, deviation->ref, deviation->exts, NULL);

    LY_LIST_FOR(deviation->deviates, elem) {
        ly_print_(pctx->out, "%*sdeviate ", INDENT);
        if (elem->mod == LYS_DEV_NOT_SUPPORTED) {
            if (elem->exts) {
                ly_print_(pctx->out, "not-supported {\n");
                LEVEL++;

                yprp_extension_instances(pctx, LY_STMT_DEVIATE, 0, elem->exts, NULL);
            } else {
                ly_print_(pctx->out, "not-supported;\n");
                continue;
            }
        } else if (elem->mod == LYS_DEV_ADD) {
            add = (struct lysp_deviate_add *)elem;
            ly_print_(pctx->out, "add {\n");
            LEVEL++;

            yprp_extension_instances(pctx, LY_STMT_DEVIATE, 0, add->exts, NULL);
            ypr_substmt(pctx, LY_STMT_UNITS, 0, add->units, add->exts);
            LY_ARRAY_FOR(add->musts, u) {
                yprp_restr(pctx, &add->musts[u], LY_STMT_MUST, NULL);
            }
            LY_ARRAY_FOR(add->uniques, u) {
                ypr_substmt(pctx, LY_STMT_UNIQUE, u, add->uniques[u].str, add->exts);
            }
            LY_ARRAY_FOR(add->dflts, u) {
                ypr_substmt(pctx, LY_STMT_DEFAULT, u, add->dflts[u].str, add->exts);
            }
            ypr_config(pctx, add->flags, add->exts, NULL);
            ypr_mandatory(pctx, add->flags, add->exts, NULL);
            if (add->flags & LYS_SET_MIN) {
                ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, add->exts, add->min, NULL);
            }
            if (add->flags & LYS_SET_MAX) {
                if (add->max) {
                    ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, add->exts, add->max, NULL);
                } else {
                    ypr_substmt(pctx, LY_STMT_MAX_ELEMENTS, 0, "unbounded", add->exts);
                }
            }
        } else if (elem->mod == LYS_DEV_REPLACE) {
            rpl = (struct lysp_deviate_rpl *)elem;
            ly_print_(pctx->out, "replace {\n");
            LEVEL++;

            yprp_extension_instances(pctx, LY_STMT_DEVIATE, 0, rpl->exts, NULL);
            if (rpl->type) {
                yprp_type(pctx, rpl->type);
            }
            ypr_substmt(pctx, LY_STMT_UNITS, 0, rpl->units, rpl->exts);
            ypr_substmt(pctx, LY_STMT_DEFAULT, 0, rpl->dflt.str, rpl->exts);
            ypr_config(pctx, rpl->flags, rpl->exts, NULL);
            ypr_mandatory(pctx, rpl->flags, rpl->exts, NULL);
            if (rpl->flags & LYS_SET_MIN) {
                ypr_unsigned(pctx, LY_STMT_MIN_ELEMENTS, 0, rpl->exts, rpl->min, NULL);
            }
            if (rpl->flags & LYS_SET_MAX) {
                if (rpl->max) {
                    ypr_unsigned(pctx, LY_STMT_MAX_ELEMENTS, 0, rpl->exts, rpl->max, NULL);
                } else {
                    ypr_substmt(pctx, LY_STMT_MAX_ELEMENTS, 0, "unbounded", rpl->exts);
                }
            }
        } else if (elem->mod == LYS_DEV_DELETE) {
            del = (struct lysp_deviate_del *)elem;
            ly_print_(pctx->out, "delete {\n");
            LEVEL++;

            yprp_extension_instances(pctx, LY_STMT_DEVIATE, 0, del->exts, NULL);
            ypr_substmt(pctx, LY_STMT_UNITS, 0, del->units, del->exts);
            LY_ARRAY_FOR(del->musts, u) {
                yprp_restr(pctx, &del->musts[u], LY_STMT_MUST, NULL);
            }
            LY_ARRAY_FOR(del->uniques, u) {
                ypr_substmt(pctx, LY_STMT_UNIQUE, u, del->uniques[u].str, del->exts);
            }
            LY_ARRAY_FOR(del->dflts, u) {
                ypr_substmt(pctx, LY_STMT_DEFAULT, u, del->dflts[u].str, del->exts);
            }
        }

        LEVEL--;
        ypr_close(pctx, 1);
    }

    LEVEL--;
    ypr_close(pctx, 1);
}

static void
yang_print_parsed_linkage(struct lys_ypr_ctx *pctx, const struct lysp_module *modp)
{
    LY_ARRAY_COUNT_TYPE u;

    LY_ARRAY_FOR(modp->imports, u) {
        if (modp->imports[u].flags & LYS_INTERNAL) {
            continue;
        }

        YPR_EXTRA_LINE_PRINT(pctx);
        ly_print_(pctx->out, "%*simport %s {\n", INDENT, modp->imports[u].name);
        LEVEL++;
        yprp_extension_instances(pctx, LY_STMT_IMPORT, 0, modp->imports[u].exts, NULL);
        ypr_substmt(pctx, LY_STMT_PREFIX, 0, modp->imports[u].prefix, modp->imports[u].exts);
        if (modp->imports[u].rev[0]) {
            ypr_substmt(pctx, LY_STMT_REVISION_DATE, 0, modp->imports[u].rev, modp->imports[u].exts);
        }
        ypr_substmt(pctx, LY_STMT_DESCRIPTION, 0, modp->imports[u].dsc, modp->imports[u].exts);
        ypr_substmt(pctx, LY_STMT_REFERENCE, 0, modp->imports[u].ref, modp->imports[u].exts);
        LEVEL--;
        ly_print_(pctx->out, "%*s}\n", INDENT);
    }
    YPR_EXTRA_LINE(modp->imports, pctx);

    LY_ARRAY_FOR(modp->includes, u) {
        if (modp->includes[u].injected) {
            /* do not print the includes injected from submodules */
            continue;
        }
        YPR_EXTRA_LINE_PRINT(pctx);
        if (modp->includes[u].rev[0] || modp->includes[u].dsc || modp->includes[u].ref || modp->includes[u].exts) {
            ly_print_(pctx->out, "%*sinclude %s {\n", INDENT, modp->includes[u].name);
            LEVEL++;
            yprp_extension_instances(pctx, LY_STMT_INCLUDE, 0, modp->includes[u].exts, NULL);
            if (modp->includes[u].rev[0]) {
                ypr_substmt(pctx, LY_STMT_REVISION_DATE, 0, modp->includes[u].rev, modp->includes[u].exts);
            }
            ypr_substmt(pctx, LY_STMT_DESCRIPTION, 0, modp->includes[u].dsc, modp->includes[u].exts);
            ypr_substmt(pctx, LY_STMT_REFERENCE, 0, modp->includes[u].ref, modp->includes[u].exts);
            LEVEL--;
            ly_print_(pctx->out, "%*s}\n", INDENT);
        } else {
            ly_print_(pctx->out, "\n%*sinclude \"%s\";\n", INDENT, modp->includes[u].name);
        }
    }
    YPR_EXTRA_LINE(modp->includes, pctx);
}

static void
yang_print_parsed_body(struct lys_ypr_ctx *pctx, const struct lysp_module *modp)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysp_node *data;
    struct lysp_node_action *action;
    struct lysp_node_notif *notif;
    struct lysp_node_grp *grp;
    struct lysp_node_augment *aug;

    LY_ARRAY_FOR(modp->extensions, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_extension(pctx, &modp->extensions[u]);
    }

    YPR_EXTRA_LINE(modp->extensions, pctx);

    if (modp->exts) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_extension_instances(pctx, LY_STMT_MODULE, 0, modp->exts, NULL);
    }

    YPR_EXTRA_LINE(modp->exts, pctx);

    LY_ARRAY_FOR(modp->features, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_feature(pctx, &modp->features[u]);
        YPR_EXTRA_LINE(1, pctx);
    }

    YPR_EXTRA_LINE(modp->features, pctx);

    LY_ARRAY_FOR(modp->identities, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_identity(pctx, &modp->identities[u]);
        YPR_EXTRA_LINE(1, pctx);
    }

    YPR_EXTRA_LINE(modp->identities, pctx);

    LY_ARRAY_FOR(modp->typedefs, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_typedef(pctx, &modp->typedefs[u]);
        YPR_EXTRA_LINE(1, pctx);
    }

    YPR_EXTRA_LINE(modp->typedefs, pctx);

    LY_LIST_FOR(modp->groupings, grp) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_grouping(pctx, grp);
        YPR_EXTRA_LINE(1, pctx);
    }

    YPR_EXTRA_LINE(modp->groupings, pctx);

    LY_LIST_FOR(modp->data, data) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_node(pctx, data);
    }

    YPR_EXTRA_LINE(modp->data, pctx);

    LY_LIST_FOR(modp->augments, aug) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_augment(pctx, aug);
    }

    YPR_EXTRA_LINE(modp->augments, pctx);

    LY_LIST_FOR(modp->rpcs, action) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_action(pctx, action);
    }

    YPR_EXTRA_LINE(modp->rpcs, pctx);

    LY_LIST_FOR(modp->notifs, notif) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_notification(pctx, notif);
    }

    YPR_EXTRA_LINE(modp->notifs, pctx);

    LY_ARRAY_FOR(modp->deviations, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_deviation(pctx, &modp->deviations[u]);
    }

    YPR_EXTRA_LINE(modp->deviations, pctx);
}

LY_ERR
yang_print_parsed_module(struct ly_out *out, const struct lysp_module *modp, uint32_t options)
{
    LY_ARRAY_COUNT_TYPE u;
    const struct lys_module *module = modp->mod;
    struct lys_ypr_ctx pctx_ = {
        .out = out,
        .level = 0,
        .options = options,
        .module = module,
        .schema = LYS_YPR_PARSED
    }, *pctx = &pctx_;

    ly_print_(pctx->out, "%*smodule %s {\n", INDENT, module->name);
    LEVEL++;

    /* module-header-stmts */
    if (modp->version) {
        ypr_substmt(pctx, LY_STMT_YANG_VERSION, 0, modp->version == LYS_VERSION_1_1 ? "1.1" : "1", modp->exts);
    }
    ypr_substmt(pctx, LY_STMT_NAMESPACE, 0, module->ns, modp->exts);
    ypr_substmt(pctx, LY_STMT_PREFIX, 0, module->prefix, modp->exts);

    YPR_EXTRA_LINE(1, pctx);

    /* linkage-stmts (import/include) */
    yang_print_parsed_linkage(pctx, modp);

    /* meta-stmts */
    if (module->org || module->contact || module->dsc || module->ref) {
        YPR_EXTRA_LINE_PRINT(pctx);
    }
    ypr_substmt(pctx, LY_STMT_ORGANIZATION, 0, module->org, modp->exts);
    ypr_substmt(pctx, LY_STMT_CONTACT, 0, module->contact, modp->exts);
    ypr_substmt(pctx, LY_STMT_DESCRIPTION, 0, module->dsc, modp->exts);
    ypr_substmt(pctx, LY_STMT_REFERENCE, 0, module->ref, modp->exts);

    YPR_EXTRA_LINE(module->org || module->contact || module->dsc || module->ref, pctx);

    /* revision-stmts */
    LY_ARRAY_FOR(modp->revs, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_revision(pctx, &modp->revs[u]);
    }

    YPR_EXTRA_LINE(modp->revs, pctx);

    /* body-stmts */
    yang_print_parsed_body(pctx, modp);

    LEVEL--;
    ly_print_(out, "%*s}\n", INDENT);
    ly_print_flush(out);

    return LY_SUCCESS;
}

static void
yprp_belongsto(struct lys_ypr_ctx *pctx, const struct lysp_submodule *submodp)
{
    ly_print_(pctx->out, "%*sbelongs-to %s {\n", INDENT, submodp->mod->name);
    LEVEL++;
    yprp_extension_instances(pctx, LY_STMT_BELONGS_TO, 0, submodp->exts, NULL);
    ypr_substmt(pctx, LY_STMT_PREFIX, 0, submodp->prefix, submodp->exts);
    LEVEL--;
    ly_print_(pctx->out, "%*s}\n", INDENT);
}

LY_ERR
yang_print_parsed_submodule(struct ly_out *out, const struct lysp_submodule *submodp, uint32_t options)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lys_ypr_ctx pctx_ = {
        .out = out,
        .level = 0,
        .options = options,
        .module = submodp->mod,
        .schema = LYS_YPR_PARSED
    }, *pctx = &pctx_;

    ly_print_(pctx->out, "%*ssubmodule %s {\n", INDENT, submodp->name);
    LEVEL++;

    /* submodule-header-stmts */
    if (submodp->version) {
        ypr_substmt(pctx, LY_STMT_YANG_VERSION, 0, submodp->version == LYS_VERSION_1_1 ? "1.1" : "1", submodp->exts);
    }

    yprp_belongsto(pctx, submodp);

    YPR_EXTRA_LINE(1, pctx);

    /* linkage-stmts (import/include) */
    yang_print_parsed_linkage(pctx, (struct lysp_module *)submodp);

    /* meta-stmts */
    if (submodp->org || submodp->contact || submodp->dsc || submodp->ref) {
        YPR_EXTRA_LINE_PRINT(pctx);
    }
    ypr_substmt(pctx, LY_STMT_ORGANIZATION, 0, submodp->org, submodp->exts);
    ypr_substmt(pctx, LY_STMT_CONTACT, 0, submodp->contact, submodp->exts);
    ypr_substmt(pctx, LY_STMT_DESCRIPTION, 0, submodp->dsc, submodp->exts);
    ypr_substmt(pctx, LY_STMT_REFERENCE, 0, submodp->ref, submodp->exts);

    YPR_EXTRA_LINE(submodp->org || submodp->contact || submodp->dsc || submodp->ref, pctx);

    /* revision-stmts */
    LY_ARRAY_FOR(submodp->revs, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprp_revision(pctx, &submodp->revs[u]);
    }

    YPR_EXTRA_LINE(submodp->revs, pctx);

    /* body-stmts */
    yang_print_parsed_body(pctx, (struct lysp_module *)submodp);

    LEVEL--;
    ly_print_(out, "%*s}\n", INDENT);
    ly_print_flush(out);

    return LY_SUCCESS;
}

LY_ERR
yang_print_compiled_node(struct ly_out *out, const struct lysc_node *node, uint32_t options)
{
    struct lys_ypr_ctx pctx_ = {
        .out = out,
        .level = 0,
        .options = options,
        .module = node->module,
        .schema = LYS_YPR_COMPILED
    }, *pctx = &pctx_;

    yprc_node(pctx, node);

    ly_print_flush(out);
    return LY_SUCCESS;
}

LY_ERR
yang_print_compiled(struct ly_out *out, const struct lys_module *module, uint32_t options)
{
    LY_ARRAY_COUNT_TYPE u;
    struct lysc_module *modc = module->compiled;
    struct lys_ypr_ctx pctx_ = {
        .out = out,
        .level = 0,
        .options = options,
        .module = module,
        .schema = LYS_YPR_COMPILED
    }, *pctx = &pctx_;

    ly_print_(pctx->out, "%*smodule %s {\n", INDENT, module->name);
    LEVEL++;

    /* module-header-stmts */
    ypr_substmt(pctx, LY_STMT_NAMESPACE, 0, module->ns, modc->exts);
    ypr_substmt(pctx, LY_STMT_PREFIX, 0, module->prefix, modc->exts);

    YPR_EXTRA_LINE(1, pctx);

    /* no linkage-stmts */

    /* meta-stmts */
    if (module->org || module->contact || module->dsc || module->ref) {
        YPR_EXTRA_LINE_PRINT(pctx);
    }
    ypr_substmt(pctx, LY_STMT_ORGANIZATION, 0, module->org, modc->exts);
    ypr_substmt(pctx, LY_STMT_CONTACT, 0, module->contact, modc->exts);
    ypr_substmt(pctx, LY_STMT_DESCRIPTION, 0, module->dsc, modc->exts);
    ypr_substmt(pctx, LY_STMT_REFERENCE, 0, module->ref, modc->exts);

    YPR_EXTRA_LINE(module->org || module->contact || module->dsc || module->ref, pctx);

    /* revision-stmts */
    if (module->revision) {
        YPR_EXTRA_LINE_PRINT(pctx);
        ly_print_(pctx->out, "%*srevision %s;\n", INDENT, module->revision);
        YPR_EXTRA_LINE(1, pctx);
    }

    /* body-stmts */
    if (modc->exts) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprc_extension_instances(pctx, LY_STMT_MODULE, 0, module->compiled->exts, NULL);
        YPR_EXTRA_LINE(1, pctx);
    }

    LY_ARRAY_FOR(module->identities, u) {
        YPR_EXTRA_LINE_PRINT(pctx);
        yprc_identity(pctx, &module->identities[u]);
        YPR_EXTRA_LINE(1, pctx);
    }

    if (!(pctx->options & LYS_PRINT_NO_SUBSTMT)) {
        struct lysc_node *data;
        struct lysc_node_action *rpc;
        struct lysc_node_notif *notif;

        LY_LIST_FOR(modc->data, data) {
            YPR_EXTRA_LINE_PRINT(pctx);
            yprc_node(pctx, data);
        }

        YPR_EXTRA_LINE(modc->data, pctx);

        LY_LIST_FOR(modc->rpcs, rpc) {
            YPR_EXTRA_LINE_PRINT(pctx);
            yprc_action(pctx, rpc);
        }

        YPR_EXTRA_LINE(modc->rpcs, pctx);

        LY_LIST_FOR(modc->notifs, notif) {
            YPR_EXTRA_LINE_PRINT(pctx);
            yprc_notification(pctx, notif);
        }

        YPR_EXTRA_LINE(modc->notifs, pctx);
    }

    LEVEL--;
    ly_print_(out, "%*s}\n", INDENT);
    ly_print_flush(out);

    return LY_SUCCESS;
}

LIBYANG_API_DEF void
lyplg_ext_print_extension_instance(struct lyspr_ctx *ctx_generic, const struct lysc_ext_instance *ext, ly_bool *flag)
{
    struct lys_ypr_ctx *pctx = (struct lys_ypr_ctx *)ctx_generic;
    LY_ARRAY_COUNT_TYPE u, v;
    ly_bool data_printed = 0;

    LY_ARRAY_FOR(ext->substmts, u) {
        switch (ext->substmts[u].stmt) {
        case LY_STMT_ACTION:
        case LY_STMT_CONTAINER:
        case LY_STMT_CHOICE:
        case LY_STMT_LEAF:
        case LY_STMT_LEAF_LIST:
        case LY_STMT_LIST:
        case LY_STMT_NOTIFICATION:
        case LY_STMT_RPC:
        case LY_STMT_ANYXML:
        case LY_STMT_ANYDATA: {
            const struct lysc_node *node;

            if (data_printed) {
                break;
            }

            LY_LIST_FOR(*(const struct lysc_node **)ext->substmts[u].storage, node) {
                ypr_open(pctx->out, flag);
                if ((ext->substmts[u].stmt == LY_STMT_ACTION) || (ext->substmts[u].stmt == LY_STMT_RPC)) {
                    yprc_action(pctx, (struct lysc_node_action *)node);
                } else if (ext->substmts[u].stmt == LY_STMT_NOTIFICATION) {
                    yprc_notification(pctx, (struct lysc_node_notif *)node);
                } else {
                    yprc_node(pctx, node);
                }
            }

            /* all data nodes are stored in a linked list so all were printed */
            data_printed = 1;
            break;
        }
        case LY_STMT_CONTACT:
        case LY_STMT_DESCRIPTION:
        case LY_STMT_ERROR_APP_TAG:
        case LY_STMT_ERROR_MESSAGE:
        case LY_STMT_KEY:
        case LY_STMT_NAMESPACE:
        case LY_STMT_ORGANIZATION:
        case LY_STMT_PRESENCE:
        case LY_STMT_REFERENCE:
        case LY_STMT_UNITS:
            if (*(const char **)ext->substmts[u].storage) {
                ypr_open(pctx->out, flag);
                ypr_substmt(pctx, ext->substmts[u].stmt, 0, *(const char **)ext->substmts[u].storage, ext->exts);
            }
            break;
        case LY_STMT_MUST: {
            const struct lysc_must *musts = *(struct lysc_must **)ext->substmts[u].storage;

            LY_ARRAY_FOR(musts, v) {
                yprc_must(pctx, &musts[v], flag);
            }
            break;
        }
        case LY_STMT_IF_FEATURE:
        case LY_STMT_USES:
        case LY_STMT_GROUPING:
        case LY_STMT_TYPEDEF:
            /* nothing to do */
            break;
        case LY_STMT_STATUS:
            ypr_status(pctx, *(uint16_t *)ext->substmts[u].storage, ext->exts, flag);
            break;
        case LY_STMT_TYPE:
            if (*(const struct lysc_type **)ext->substmts[u].storage) {
                ypr_open(pctx->out, flag);
                yprc_type(pctx, *(const struct lysc_type **)ext->substmts[u].storage);
            }
            break;
        /* TODO support other substatements */
        default:
            LOGWRN(pctx->module->ctx, "Statement \"%s\" is not supported for an extension printer.",
                    lyplg_ext_stmt2str(ext->substmts[u].stmt));
            break;
        }
    }
}
