schema REFACTOR simplify and unify statements lists

avoid information duplication in several statements lists and unify
statements names
diff --git a/src/common.c b/src/common.c
index e96f6dd..bc5de36 100644
--- a/src/common.c
+++ b/src/common.c
@@ -31,125 +31,6 @@
 #include "tree_schema.h"
 #include "tree_schema_internal.h"
 
-const char * const ly_stmt_list[] = {
-    [LY_STMT_ACTION] = "action",
-    [LY_STMT_ANYDATA] = "anydata",
-    [LY_STMT_ANYXML] = "anyxml",
-    [LY_STMT_ARGUMENT] = "argument",
-    [LY_STMT_AUGMENT] = "augment",
-    [LY_STMT_BASE] = "base",
-    [LY_STMT_BELONGS_TO] = "belongs-to",
-    [LY_STMT_BIT] = "bit",
-    [LY_STMT_CASE] = "case",
-    [LY_STMT_CHOICE] = "choice",
-    [LY_STMT_CONFIG] = "config",
-    [LY_STMT_CONTACT] = "contact",
-    [LY_STMT_CONTAINER] = "container",
-    [LY_STMT_EXTENSION_INSTANCE] = "<extension-instance>",
-    [LY_STMT_DEFAULT] = "default",
-    [LY_STMT_DESCRIPTION] = "description",
-    [LY_STMT_DEVIATE] = "deviate",
-    [LY_STMT_DEVIATION] = "deviation",
-    [LY_STMT_ENUM] = "enum",
-    [LY_STMT_ERROR_APP_TAG] = "error-app-tag",
-    [LY_STMT_ERROR_MESSAGE] = "error-message",
-    [LY_STMT_EXTENSION] = "extension",
-    [LY_STMT_FEATURE] = "feature",
-    [LY_STMT_FRACTION_DIGITS] = "fraction-digits",
-    [LY_STMT_GROUPING] = "grouping",
-    [LY_STMT_IDENTITY] = "identity",
-    [LY_STMT_IF_FEATURE] = "if-feature",
-    [LY_STMT_IMPORT] = "import",
-    [LY_STMT_INCLUDE] = "include",
-    [LY_STMT_INPUT] = "input",
-    [LY_STMT_KEY] = "key",
-    [LY_STMT_LEAF] = "leaf",
-    [LY_STMT_LEAF_LIST] = "leaf-list",
-    [LY_STMT_LENGTH] = "length",
-    [LY_STMT_LIST] = "list",
-    [LY_STMT_MANDATORY] = "mandatory",
-    [LY_STMT_MAX_ELEMENTS] = "max-elements",
-    [LY_STMT_MIN_ELEMENTS] = "min-elements",
-    [LY_STMT_MODIFIER] = "modifier",
-    [LY_STMT_MODULE] = "module",
-    [LY_STMT_MUST] = "must",
-    [LY_STMT_NAMESPACE] = "namespace",
-    [LY_STMT_NOTIFICATION] = "notification",
-    [LY_STMT_ORDERED_BY] = "ordered-by",
-    [LY_STMT_ORGANIZATION] = "organization",
-    [LY_STMT_OUTPUT] = "output",
-    [LY_STMT_PATH] = "path",
-    [LY_STMT_PATTERN] = "pattern",
-    [LY_STMT_POSITION] = "position",
-    [LY_STMT_PREFIX] = "prefix",
-    [LY_STMT_PRESENCE] = "presence",
-    [LY_STMT_RANGE] = "range",
-    [LY_STMT_REFERENCE] = "reference",
-    [LY_STMT_REFINE] = "refine",
-    [LY_STMT_REQUIRE_INSTANCE] = "require-instance",
-    [LY_STMT_REVISION] = "revision",
-    [LY_STMT_REVISION_DATE] = "revision-date",
-    [LY_STMT_RPC] = "rpc",
-    [LY_STMT_STATUS] = "status",
-    [LY_STMT_SUBMODULE] = "submodule",
-    [LY_STMT_TYPE] = "type",
-    [LY_STMT_TYPEDEF] = "typedef",
-    [LY_STMT_UNIQUE] = "unique",
-    [LY_STMT_UNITS] = "units",
-    [LY_STMT_USES] = "uses",
-    [LY_STMT_VALUE] = "value",
-    [LY_STMT_WHEN] = "when",
-    [LY_STMT_YANG_VERSION] = "yang-version",
-    [LY_STMT_YIN_ELEMENT] = "yin-element",
-    [LY_STMT_SYNTAX_SEMICOLON] = ";",
-    [LY_STMT_SYNTAX_LEFT_BRACE] = "{",
-    [LY_STMT_SYNTAX_RIGHT_BRACE] = "}",
-    [LY_STMT_ARG_TEXT] = "text",
-    [LY_STMT_ARG_VALUE] = "value",
-};
-
-const char * const lyext_substmt_list[] = {
-    [LYEXT_SUBSTMT_ARGUMENT] = "argument",
-    [LYEXT_SUBSTMT_BASE] = "base",
-    [LYEXT_SUBSTMT_BELONGSTO] = "belongs-to",
-    [LYEXT_SUBSTMT_CONTACT] = "contact",
-    [LYEXT_SUBSTMT_DEFAULT] = "default",
-    [LYEXT_SUBSTMT_DESCRIPTION] = "description",
-    [LYEXT_SUBSTMT_ERRTAG] = "error-app-tag",
-    [LYEXT_SUBSTMT_ERRMSG] = "error-message",
-    [LYEXT_SUBSTMT_KEY] = "key",
-    [LYEXT_SUBSTMT_NAMESPACE] = "namespace",
-    [LYEXT_SUBSTMT_ORGANIZATION] = "organization",
-    [LYEXT_SUBSTMT_PATH] = "path",
-    [LYEXT_SUBSTMT_PREFIX] = "prefix",
-    [LYEXT_SUBSTMT_PRESENCE] = "presence",
-    [LYEXT_SUBSTMT_REFERENCE] = "reference",
-    [LYEXT_SUBSTMT_REVISIONDATE] = "revision-date",
-    [LYEXT_SUBSTMT_UNITS] = "units",
-    [LYEXT_SUBSTMT_VALUE] = "value",
-    [LYEXT_SUBSTMT_VERSION] = "yang-version",
-    [LYEXT_SUBSTMT_MODIFIER] = "modifier",
-    [LYEXT_SUBSTMT_REQINSTANCE] = "require-instance",
-    [LYEXT_SUBSTMT_YINELEM] = "yin-element",
-    [LYEXT_SUBSTMT_CONFIG] = "config",
-    [LYEXT_SUBSTMT_MANDATORY] = "mandatory",
-    [LYEXT_SUBSTMT_ORDEREDBY] = "ordered-by",
-    [LYEXT_SUBSTMT_STATUS] = "status",
-    [LYEXT_SUBSTMT_FRACDIGITS] = "fraction-digits",
-    [LYEXT_SUBSTMT_MAX] = "max-elements",
-    [LYEXT_SUBSTMT_MIN] = "min-elements",
-    [LYEXT_SUBSTMT_POSITION] = "position",
-    [LYEXT_SUBSTMT_UNIQUE] = "unique",
-    [LYEXT_SUBSTMT_IFFEATURE] = "if-feature",
-};
-
-const char * const ly_devmod_list[] = {
-    [LYS_DEV_NOT_SUPPORTED] = "not-supported",
-    [LYS_DEV_ADD] = "add",
-    [LYS_DEV_DELETE] = "delete",
-    [LYS_DEV_REPLACE] = "replace",
-};
-
 void *
 ly_realloc(void *ptr, size_t size)
 {
diff --git a/src/common.h b/src/common.h
index e1e8319..a9e100e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -314,22 +314,6 @@
 struct lys_module *ly_ctx_get_module_implemented2(const struct ly_ctx *ctx, const char *name, size_t name_len);
 
 /******************************************************************************
- * Parsers
- *****************************************************************************/
-
-/* list of the YANG statements strings */
-extern const char * const ly_stmt_list[];
-#define ly_stmt2str(STMT) ly_stmt_list[STMT]
-
-/* list of the extensions' substatements strings */
-extern const char * const lyext_substmt_list[];
-#define lyext_substmt2str(STMT) lyext_substmt_list[STMT]
-
-/* list of the deviate modifications strings */
-extern const char * const ly_devmod_list[];
-#define ly_devmod2str(TYPE) ly_devmod_list[TYPE]
-
-/******************************************************************************
  * Generic useful functions.
  *****************************************************************************/
 
diff --git a/src/out.c b/src/out.c
index f82223b..3a7999d 100644
--- a/src/out.c
+++ b/src/out.c
@@ -35,44 +35,6 @@
 #include "tree_data.h"
 #include "tree_schema.h"
 
-/**
- * @brief informational structure shared by printers
- */
-struct ext_substmt_info_s ext_substmt_info[] = {
-    {NULL, NULL, 0},                            /**< LYEXT_SUBSTMT_SELF */
-    {"argument", "name", SUBST_FLAG_ID},        /**< LYEXT_SUBSTMT_ARGUMENT */
-    {"base", "name", SUBST_FLAG_ID},            /**< LYEXT_SUBSTMT_BASE */
-    {"belongs-to", "module", SUBST_FLAG_ID},    /**< LYEXT_SUBSTMT_BELONGSTO */
-    {"contact", "text", SUBST_FLAG_YIN},        /**< LYEXT_SUBSTMT_CONTACT */
-    {"default", "value", 0},                    /**< LYEXT_SUBSTMT_DEFAULT */
-    {"description", "text", SUBST_FLAG_YIN},    /**< LYEXT_SUBSTMT_DESCRIPTION */
-    {"error-app-tag", "value", 0},              /**< LYEXT_SUBSTMT_ERRTAG */
-    {"error-message", "value", SUBST_FLAG_YIN}, /**< LYEXT_SUBSTMT_ERRMSG */
-    {"key", "value", 0},                        /**< LYEXT_SUBSTMT_KEY */
-    {"namespace", "uri", 0},                    /**< LYEXT_SUBSTMT_NAMESPACE */
-    {"organization", "text", SUBST_FLAG_YIN},   /**< LYEXT_SUBSTMT_ORGANIZATION */
-    {"path", "value", 0},                       /**< LYEXT_SUBSTMT_PATH */
-    {"prefix", "value", SUBST_FLAG_ID},         /**< LYEXT_SUBSTMT_PREFIX */
-    {"presence", "value", 0},                   /**< LYEXT_SUBSTMT_PRESENCE */
-    {"reference", "text", SUBST_FLAG_YIN},      /**< LYEXT_SUBSTMT_REFERENCE */
-    {"revision-date", "date", SUBST_FLAG_ID},   /**< LYEXT_SUBSTMT_REVISIONDATE */
-    {"units", "name", 0},                       /**< LYEXT_SUBSTMT_UNITS */
-    {"value", "value", SUBST_FLAG_ID},          /**< LYEXT_SUBSTMT_VALUE */
-    {"yang-version", "value", SUBST_FLAG_ID},   /**< LYEXT_SUBSTMT_VERSION */
-    {"modifier", "value", SUBST_FLAG_ID},       /**< LYEXT_SUBSTMT_MODIFIER */
-    {"require-instance", "value", SUBST_FLAG_ID}, /**< LYEXT_SUBSTMT_REQINST */
-    {"yin-element", "value", SUBST_FLAG_ID},    /**< LYEXT_SUBSTMT_YINELEM */
-    {"config", "value", SUBST_FLAG_ID},         /**< LYEXT_SUBSTMT_CONFIG */
-    {"mandatory", "value", SUBST_FLAG_ID},      /**< LYEXT_SUBSTMT_MANDATORY */
-    {"ordered-by", "value", SUBST_FLAG_ID},     /**< LYEXT_SUBSTMT_ORDEREDBY */
-    {"status", "value", SUBST_FLAG_ID},         /**< LYEXT_SUBSTMT_STATUS */
-    {"fraction-digits", "value", SUBST_FLAG_ID}, /**< LYEXT_SUBSTMT_DIGITS */
-    {"max-elements", "value", SUBST_FLAG_ID},   /**< LYEXT_SUBSTMT_MAX */
-    {"min-elements", "value", SUBST_FLAG_ID},   /**< LYEXT_SUBSTMT_MIN */
-    {"position", "value", SUBST_FLAG_ID},       /**< LYEXT_SUBSTMT_POSITION */
-    {"unique", "tag", 0},                       /**< LYEXT_SUBSTMT_UNIQUE */
-};
-
 ly_bool
 ly_should_print(const struct lyd_node *node, uint32_t options)
 {
diff --git a/src/parser_stmt.c b/src/parser_stmt.c
index 12748a8..566f39d 100644
--- a/src/parser_stmt.c
+++ b/src/parser_stmt.c
@@ -314,10 +314,10 @@
             LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_REFERENCE, 0, &restr->ref, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_APP_TAG:
-            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERRTAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_MESSAGE:
-            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERRMSG, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_EXTENSION_INSTANCE:
             LY_CHECK_RET(lysp_stmt_ext(ctx, child, LYEXT_SUBSTMT_SELF, 0, &restr->exts));
@@ -474,7 +474,7 @@
             break;
         case LY_STMT_IF_FEATURE:
             PARSER_CHECK_STMTVER2_RET(ctx, "if-feature", ly_stmt2str(enum_kw));
-            LY_CHECK_RET(lysp_stmt_qnames(ctx, child, LYEXT_SUBSTMT_IFFEATURE, &enm->iffeatures, Y_STR_ARG, &enm->exts));
+            LY_CHECK_RET(lysp_stmt_qnames(ctx, child, LYEXT_SUBSTMT_IF_FEATURE, &enm->iffeatures, Y_STR_ARG, &enm->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_REFERENCE, 0, &enm->ref, Y_STR_ARG, &enm->exts));
@@ -554,7 +554,7 @@
 
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(lysp_stmt_ext(ctx, child, LYEXT_SUBSTMT_FRACDIGITS, 0, exts));
+            LY_CHECK_RET(lysp_stmt_ext(ctx, child, LYEXT_SUBSTMT_FRACTION_DIGITS, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "fraction-digits");
@@ -605,7 +605,7 @@
 
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(lysp_stmt_ext(ctx, child, LYEXT_SUBSTMT_REQINSTANCE, 0, exts));
+            LY_CHECK_RET(lysp_stmt_ext(ctx, child, LYEXT_SUBSTMT_REQUIRE_INSTANCE, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "require-instance");
@@ -716,10 +716,10 @@
             LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_REFERENCE, 0, &restr->ref, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_APP_TAG:
-            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERRTAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_MESSAGE:
-            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERRMSG, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(lysp_stmt_text_field(ctx, child, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_MODIFIER:
             PARSER_CHECK_STMTVER2_RET(ctx, "modifier", "pattern");
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 857197a..c6433a7 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -944,7 +944,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_VERSION, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_YANG_VERSION, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "yang-version");
@@ -992,7 +992,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_PREFIX, 0, prefix, Y_IDENTIF_ARG, exts));
             break;
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_BELONGSTO, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_BELONGS_TO, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "belongs-to");
@@ -1047,7 +1047,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_REVISIONDATE, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_REVISION_DATE, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "revision-date");
@@ -1433,10 +1433,10 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &restr->ref, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_APP_TAG:
-            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERRTAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_MESSAGE:
-            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERRMSG, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_EXTENSION_INSTANCE:
             LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_SELF, 0, &restr->exts));
@@ -1605,7 +1605,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &any->dsc, Y_STR_ARG, &any->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &any->iffeatures, Y_STR_ARG, &any->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &any->iffeatures, Y_STR_ARG, &any->exts));
             break;
         case LY_STMT_MANDATORY:
             LY_CHECK_RET(parse_mandatory(ctx, &any->flags, &any->exts));
@@ -1754,7 +1754,7 @@
             break;
         case LY_STMT_IF_FEATURE:
             PARSER_CHECK_STMTVER2_RET(ctx, "if-feature", ly_stmt2str(enum_kw));
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &enm->iffeatures, Y_STR_ARG, &enm->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &enm->iffeatures, Y_STR_ARG, &enm->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &enm->ref, Y_STR_ARG, &enm->exts));
@@ -1834,7 +1834,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_FRACDIGITS, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_FRACTION_DIGITS, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "fraction-digits");
@@ -1884,7 +1884,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_REQINSTANCE, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_REQUIRE_INSTANCE, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "require-instance");
@@ -1994,10 +1994,10 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &restr->ref, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_APP_TAG:
-            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERRTAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, &restr->eapptag, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_ERROR_MESSAGE:
-            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERRMSG, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
+            LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, &restr->emsg, Y_STR_ARG, &restr->exts));
             break;
         case LY_STMT_MODIFIER:
             PARSER_CHECK_STMTVER2_RET(ctx, "modifier", "pattern");
@@ -2161,7 +2161,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &leaf->dsc, Y_STR_ARG, &leaf->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &leaf->iffeatures, Y_STR_ARG, &leaf->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &leaf->iffeatures, Y_STR_ARG, &leaf->exts));
             break;
         case LY_STMT_MANDATORY:
             LY_CHECK_RET(parse_mandatory(ctx, &leaf->flags, &leaf->exts));
@@ -2262,7 +2262,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_MAX, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "max-elements");
@@ -2325,7 +2325,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_MIN, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "min-elements");
@@ -2374,7 +2374,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_ORDEREDBY, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_ORDERED_BY, 0, exts));
             break;
         default:
             LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "ordered-by");
@@ -2424,7 +2424,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &llist->dsc, Y_STR_ARG, &llist->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &llist->iffeatures, Y_STR_ARG, &llist->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &llist->iffeatures, Y_STR_ARG, &llist->exts));
             break;
         case LY_STMT_MAX_ELEMENTS:
             LY_CHECK_RET(parse_maxelements(ctx, &llist->max, &llist->flags, &llist->exts));
@@ -2509,7 +2509,7 @@
             break;
         case LY_STMT_IF_FEATURE:
             PARSER_CHECK_STMTVER2_RET(ctx, "if-feature", "refine");
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &rf->iffeatures, Y_STR_ARG, &rf->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &rf->iffeatures, Y_STR_ARG, &rf->exts));
             break;
         case LY_STMT_MAX_ELEMENTS:
             LY_CHECK_RET(parse_maxelements(ctx, &rf->max, &rf->flags, &rf->exts));
@@ -2725,7 +2725,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &act->dsc, Y_STR_ARG, &act->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &act->iffeatures, Y_STR_ARG, &act->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &act->iffeatures, Y_STR_ARG, &act->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &act->ref, Y_STR_ARG, &act->exts));
@@ -2804,7 +2804,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &notif->dsc, Y_STR_ARG, &notif->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &notif->iffeatures, Y_STR_ARG, &notif->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &notif->iffeatures, Y_STR_ARG, &notif->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &notif->ref, Y_STR_ARG, &notif->exts));
@@ -2980,7 +2980,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &aug->dsc, Y_STR_ARG, &aug->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &aug->iffeatures, Y_STR_ARG, &aug->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &aug->iffeatures, Y_STR_ARG, &aug->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &aug->ref, Y_STR_ARG, &aug->exts));
@@ -3073,7 +3073,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &uses->dsc, Y_STR_ARG, &uses->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &uses->iffeatures, Y_STR_ARG, &uses->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &uses->iffeatures, Y_STR_ARG, &uses->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &uses->ref, Y_STR_ARG, &uses->exts));
@@ -3136,7 +3136,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &cas->dsc, Y_STR_ARG, &cas->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &cas->iffeatures, Y_STR_ARG, &cas->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &cas->iffeatures, Y_STR_ARG, &cas->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &cas->ref, Y_STR_ARG, &cas->exts));
@@ -3219,7 +3219,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &choice->dsc, Y_STR_ARG, &choice->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &choice->iffeatures, Y_STR_ARG, &choice->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &choice->iffeatures, Y_STR_ARG, &choice->exts));
             break;
         case LY_STMT_MANDATORY:
             LY_CHECK_RET(parse_mandatory(ctx, &choice->flags, &choice->exts));
@@ -3311,7 +3311,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &cont->dsc, Y_STR_ARG, &cont->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &cont->iffeatures, Y_STR_ARG, &cont->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &cont->iffeatures, Y_STR_ARG, &cont->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &cont->ref, Y_STR_ARG, &cont->exts));
@@ -3416,7 +3416,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &list->dsc, Y_STR_ARG, &list->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &list->iffeatures, Y_STR_ARG, &list->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &list->iffeatures, Y_STR_ARG, &list->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &list->ref, Y_STR_ARG, &list->exts));
@@ -3536,7 +3536,7 @@
     YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, ) {
         switch (kw) {
         case LY_STMT_EXTENSION_INSTANCE:
-            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_YINELEM, 0, exts));
+            LY_CHECK_RET(parse_ext(ctx, word, word_len, LYEXT_SUBSTMT_YIN_ELEMENT, 0, exts));
             LY_CHECK_RET(ret);
             break;
         default:
@@ -3930,7 +3930,7 @@
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, &feat->dsc, Y_STR_ARG, &feat->exts));
             break;
         case LY_STMT_IF_FEATURE:
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &feat->iffeatures, Y_STR_ARG, &feat->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &feat->iffeatures, Y_STR_ARG, &feat->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &feat->ref, Y_STR_ARG, &feat->exts));
@@ -3979,7 +3979,7 @@
             break;
         case LY_STMT_IF_FEATURE:
             PARSER_CHECK_STMTVER2_RET(ctx, "if-feature", "identity");
-            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IFFEATURE, &ident->iffeatures, Y_STR_ARG, &ident->exts));
+            LY_CHECK_RET(parse_qnames(ctx, LYEXT_SUBSTMT_IF_FEATURE, &ident->iffeatures, Y_STR_ARG, &ident->exts));
             break;
         case LY_STMT_REFERENCE:
             LY_CHECK_RET(parse_text_field(ctx, LYEXT_SUBSTMT_REFERENCE, 0, &ident->ref, Y_STR_ARG, &ident->exts));
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 7255c4c..597fc6e 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -2774,7 +2774,7 @@
     case LY_STMT_BASE:
         return LYEXT_SUBSTMT_BASE;
     case LY_STMT_BELONGS_TO:
-        return LYEXT_SUBSTMT_BELONGSTO;
+        return LYEXT_SUBSTMT_BELONGS_TO;
     case LY_STMT_CONTACT:
         return LYEXT_SUBSTMT_CONTACT;
     case LY_STMT_DEFAULT:
@@ -2782,9 +2782,9 @@
     case LY_STMT_DESCRIPTION:
         return LYEXT_SUBSTMT_DESCRIPTION;
     case LY_STMT_ERROR_APP_TAG:
-        return LYEXT_SUBSTMT_ERRTAG;
+        return LYEXT_SUBSTMT_ERROR_APP_TAG;
     case LY_STMT_ERROR_MESSAGE:
-        return LYEXT_SUBSTMT_ERRMSG;
+        return LYEXT_SUBSTMT_ERROR_MESSAGE;
     case LY_STMT_KEY:
         return LYEXT_SUBSTMT_KEY;
     case LY_STMT_NAMESPACE:
@@ -2800,39 +2800,39 @@
     case LY_STMT_REFERENCE:
         return LYEXT_SUBSTMT_REFERENCE;
     case LY_STMT_REVISION_DATE:
-        return LYEXT_SUBSTMT_REVISIONDATE;
+        return LYEXT_SUBSTMT_REVISION_DATE;
     case LY_STMT_UNITS:
         return LYEXT_SUBSTMT_UNITS;
     case LY_STMT_VALUE:
         return LYEXT_SUBSTMT_VALUE;
     case LY_STMT_YANG_VERSION:
-        return LYEXT_SUBSTMT_VERSION;
+        return LYEXT_SUBSTMT_YANG_VERSION;
     case LY_STMT_MODIFIER:
         return LYEXT_SUBSTMT_MODIFIER;
     case LY_STMT_REQUIRE_INSTANCE:
-        return LYEXT_SUBSTMT_REQINSTANCE;
+        return LYEXT_SUBSTMT_REQUIRE_INSTANCE;
     case LY_STMT_YIN_ELEMENT:
-        return LYEXT_SUBSTMT_YINELEM;
+        return LYEXT_SUBSTMT_YIN_ELEMENT;
     case LY_STMT_CONFIG:
         return LYEXT_SUBSTMT_CONFIG;
     case LY_STMT_MANDATORY:
         return LYEXT_SUBSTMT_MANDATORY;
     case LY_STMT_ORDERED_BY:
-        return LYEXT_SUBSTMT_ORDEREDBY;
+        return LYEXT_SUBSTMT_ORDERED_BY;
     case LY_STMT_STATUS:
         return LYEXT_SUBSTMT_STATUS;
     case LY_STMT_FRACTION_DIGITS:
-        return LYEXT_SUBSTMT_FRACDIGITS;
+        return LYEXT_SUBSTMT_FRACTION_DIGITS;
     case LY_STMT_MAX_ELEMENTS:
-        return LYEXT_SUBSTMT_MAX;
+        return LYEXT_SUBSTMT_MAX_ELEMENTS;
     case LY_STMT_MIN_ELEMENTS:
-        return LYEXT_SUBSTMT_MIN;
+        return LYEXT_SUBSTMT_MIN_ELEMENTS;
     case LY_STMT_POSITION:
         return LYEXT_SUBSTMT_POSITION;
     case LY_STMT_UNIQUE:
         return LYEXT_SUBSTMT_UNIQUE;
     case LY_STMT_IF_FEATURE:
-        return LYEXT_SUBSTMT_IFFEATURE;
+        return LYEXT_SUBSTMT_IF_FEATURE;
     default:
         return LYEXT_SUBSTMT_SELF;
     }
diff --git a/src/printer_internal.h b/src/printer_internal.h
index 3edae93..05f2dc7 100644
--- a/src/printer_internal.h
+++ b/src/printer_internal.h
@@ -23,20 +23,6 @@
 struct lysp_submodule;
 
 /**
- * @brief Informational structure for YANG statements
- */
-struct ext_substmt_info_s {
-    const char *name;      /**< name of the statement */
-    const char *arg;       /**< name of YIN's attribute to present the statement */
-    uint8_t flags;         /**< various flags to clarify printing of the statement */
-#define SUBST_FLAG_YIN 0x1 /**< has YIN element */
-#define SUBST_FLAG_ID 0x2  /**< the value is identifier -> no quotes */
-};
-
-/* filled in out.c */
-extern struct ext_substmt_info_s ext_substmt_info[];
-
-/**
  * @brief YANG printer of the parsed module. Full YANG printer.
  *
  * @param[in] out Output specification.
diff --git a/src/printer_yang.c b/src/printer_yang.c
index 68c4b48..f41ad9a 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -319,11 +319,11 @@
         return;
     }
 
-    if (ext_substmt_info[substmt].flags & SUBST_FLAG_ID) {
-        ly_print_(ctx->out, "%*s%s %s", INDENT, ext_substmt_info[substmt].name, text);
+    if (stmt_attr_info[substmt].flags & STMT_FLAG_ID) {
+        ly_print_(ctx->out, "%*s%s %s", INDENT, stmt_attr_info[substmt].name, text);
     } else {
-        ypr_text(ctx, ext_substmt_info[substmt].name, text,
-                (ext_substmt_info[substmt].flags & SUBST_FLAG_YIN) ? 0 : 1, 0);
+        ypr_text(ctx, stmt_attr_info[substmt].name, text,
+                (stmt_attr_info[substmt].flags & STMT_FLAG_YIN) ? 0 : 1, 0);
     }
 
     LEVEL++;
@@ -455,7 +455,7 @@
         /* extensions */
         LEVEL++;
         LY_ARRAY_FOR(exts, v) {
-            yprp_extension_instances(ctx, LYEXT_SUBSTMT_IFFEATURE, u, &exts[v], &extflag, 1);
+            yprp_extension_instances(ctx, LYEXT_SUBSTMT_IF_FEATURE, u, &exts[v], &extflag, 1);
         }
         LEVEL--;
         ypr_close(ctx, extflag);
@@ -486,9 +486,9 @@
             }
         }
         if ((ext->flags & LYS_YINELEM_MASK) ||
-                (ext->exts && (lysp_ext_instance_iter(ext->exts, 0, LYEXT_SUBSTMT_YINELEM) != LY_ARRAY_COUNT(ext->exts)))) {
+                (ext->exts && (lysp_ext_instance_iter(ext->exts, 0, LYEXT_SUBSTMT_YIN_ELEMENT) != LY_ARRAY_COUNT(ext->exts)))) {
             ypr_open(ctx->out, &flag2);
-            ypr_substmt(ctx, LYEXT_SUBSTMT_YINELEM, 0, (ext->flags & LYS_YINELEM_TRUE) ? "true" : "false", ext->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_YIN_ELEMENT, 0, (ext->flags & LYS_YINELEM_TRUE) ? "true" : "false", ext->exts);
         }
         LEVEL--;
         ypr_close(ctx, flag2);
@@ -596,11 +596,11 @@
     }
     if (restr->emsg) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRMSG, 0, restr->emsg, restr->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, restr->emsg, restr->exts);
     }
     if (restr->eapptag) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRTAG, 0, restr->eapptag, restr->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, restr->eapptag, restr->exts);
     }
     ypr_description(ctx, restr->dsc, restr->exts, &inner_flag);
     ypr_reference(ctx, restr->ref, restr->exts, &inner_flag);
@@ -623,11 +623,11 @@
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, must->exts, &inner_flag, 0);
     if (must->emsg) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRMSG, 0, must->emsg, must->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, must->emsg, must->exts);
     }
     if (must->eapptag) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRTAG, 0, must->eapptag, must->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, must->eapptag, must->exts);
     }
     ypr_description(ctx, must->dsc, must->exts, &inner_flag);
     ypr_reference(ctx, must->ref, must->exts, &inner_flag);
@@ -672,11 +672,11 @@
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, range->exts, &inner_flag, 0);
     if (range->emsg) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRMSG, 0, range->emsg, range->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, range->emsg, range->exts);
     }
     if (range->eapptag) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRTAG, 0, range->eapptag, range->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, range->eapptag, range->exts);
     }
     ypr_description(ctx, range->dsc, range->exts, &inner_flag);
     ypr_reference(ctx, range->ref, range->exts, &inner_flag);
@@ -704,11 +704,11 @@
     }
     if (pattern->emsg) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRMSG, 0, pattern->emsg, pattern->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, pattern->emsg, pattern->exts);
     }
     if (pattern->eapptag) {
         ypr_open(ctx->out, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRTAG, 0, pattern->eapptag, pattern->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, pattern->eapptag, pattern->exts);
     }
     ypr_description(ctx, pattern->dsc, pattern->exts, &inner_flag);
     ypr_reference(ctx, pattern->ref, pattern->exts, &inner_flag);
@@ -820,10 +820,10 @@
     }
     if (type->flags & LYS_SET_REQINST) {
         ypr_open(ctx->out, &flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_REQINSTANCE, 0, type->require_instance ? "true" : "false", type->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_REQUIRE_INSTANCE, 0, type->require_instance ? "true" : "false", type->exts);
     }
     if (type->flags & LYS_SET_FRDIGITS) {
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_FRACDIGITS, 0, type->exts, type->fraction_digits, &flag);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_FRACTION_DIGITS, 0, type->exts, type->fraction_digits, &flag);
     }
     LY_ARRAY_FOR(type->bases, u) {
         ypr_open(ctx->out, &flag);
@@ -922,7 +922,7 @@
     case LY_TYPE_DEC64: {
         struct lysc_type_dec *dec = (struct lysc_type_dec *)type;
         ypr_open(ctx->out, &flag);
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_FRACDIGITS, 0, type->exts, dec->fraction_digits, &flag);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_FRACTION_DIGITS, 0, type->exts, dec->fraction_digits, &flag);
         yprc_range(ctx, dec->range, dec->basetype, &flag);
         break;
     }
@@ -937,14 +937,14 @@
     case LY_TYPE_INST: {
         struct lysc_type_instanceid *inst = (struct lysc_type_instanceid *)type;
         ypr_open(ctx->out, &flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_REQINSTANCE, 0, inst->require_instance ? "true" : "false", inst->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_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(ctx->out, &flag);
         ypr_substmt(ctx, LYEXT_SUBSTMT_PATH, 0, lr->path->expr, lr->exts);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_REQINSTANCE, 0, lr->require_instance ? "true" : "false", lr->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_REQUIRE_INSTANCE, 0, lr->require_instance ? "true" : "false", lr->exts);
         yprc_type(ctx, lr->realtype);
         break;
     }
@@ -1530,18 +1530,18 @@
     ypr_config(ctx, node->flags, node->exts, NULL);
 
     if (llist->flags & LYS_SET_MIN) {
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, llist->exts, llist->min, NULL);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, llist->exts, llist->min, NULL);
     }
     if (llist->flags & LYS_SET_MAX) {
         if (llist->max) {
-            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, llist->exts, llist->max, NULL);
+            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, llist->exts, llist->max, NULL);
         } else {
-            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", llist->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", llist->exts);
         }
     }
 
     if (llist->flags & LYS_ORDBY_MASK) {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDEREDBY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDERED_BY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);
     }
 
     ypr_status(ctx, node->flags, node->exts, NULL);
@@ -1571,14 +1571,14 @@
 
     ypr_config(ctx, node->flags, node->exts, NULL);
 
-    ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, llist->exts, llist->min, NULL);
+    ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, llist->exts, llist->min, NULL);
     if (llist->max) {
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, llist->exts, llist->max, NULL);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, llist->exts, llist->max, NULL);
     } else {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", llist->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", llist->exts);
     }
 
-    ypr_substmt(ctx, LYEXT_SUBSTMT_ORDEREDBY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);
+    ypr_substmt(ctx, LYEXT_SUBSTMT_ORDERED_BY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);
 
     ypr_status(ctx, node->flags, node->exts, NULL);
     ypr_description(ctx, node->dsc, node->exts, NULL);
@@ -1616,20 +1616,20 @@
     ypr_config(ctx, node->flags, node->exts, &flag);
 
     if (list->flags & LYS_SET_MIN) {
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, list->exts, list->min, &flag);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, list->exts, list->min, &flag);
     }
     if (list->flags & LYS_SET_MAX) {
         if (list->max) {
-            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, list->exts, list->max, &flag);
+            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, list->exts, list->max, &flag);
         } else {
             ypr_open(ctx->out, &flag);
-            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", list->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", list->exts);
         }
     }
 
     if (list->flags & LYS_ORDBY_MASK) {
         ypr_open(ctx->out, &flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDEREDBY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDERED_BY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);
     }
 
     ypr_status(ctx, node->flags, node->exts, &flag);
@@ -1693,14 +1693,14 @@
 
     ypr_config(ctx, node->flags, node->exts, NULL);
 
-    ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, list->exts, list->min, NULL);
+    ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, list->exts, list->min, NULL);
     if (list->max) {
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, list->exts, list->max, NULL);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, list->exts, list->max, NULL);
     } else {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", list->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", list->exts);
     }
 
-    ypr_substmt(ctx, LYEXT_SUBSTMT_ORDEREDBY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);
+    ypr_substmt(ctx, LYEXT_SUBSTMT_ORDERED_BY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);
 
     ypr_status(ctx, node->flags, node->exts, NULL);
     ypr_description(ctx, node->dsc, node->exts, NULL);
@@ -1760,14 +1760,14 @@
 
     if (refine->flags & LYS_SET_MIN) {
         ypr_open(ctx->out, &flag);
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, refine->exts, refine->min, NULL);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, refine->exts, refine->min, NULL);
     }
     if (refine->flags & LYS_SET_MAX) {
         ypr_open(ctx->out, &flag);
         if (refine->max) {
-            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, refine->exts, refine->max, NULL);
+            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, refine->exts, refine->max, NULL);
         } else {
-            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", refine->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", refine->exts);
         }
     }
 
@@ -1985,13 +1985,13 @@
             ypr_config(ctx, add->flags, add->exts, NULL);
             ypr_mandatory(ctx, add->flags, add->exts, NULL);
             if (add->flags & LYS_SET_MIN) {
-                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, add->exts, add->min, NULL);
+                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, add->exts, add->min, NULL);
             }
             if (add->flags & LYS_SET_MAX) {
                 if (add->max) {
-                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, add->exts, add->max, NULL);
+                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, add->exts, add->max, NULL);
                 } else {
-                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", add->exts);
+                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", add->exts);
                 }
             }
         } else if (elem->mod == LYS_DEV_REPLACE) {
@@ -2008,13 +2008,13 @@
             ypr_config(ctx, rpl->flags, rpl->exts, NULL);
             ypr_mandatory(ctx, rpl->flags, rpl->exts, NULL);
             if (rpl->flags & LYS_SET_MIN) {
-                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, rpl->exts, rpl->min, NULL);
+                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, rpl->exts, rpl->min, NULL);
             }
             if (rpl->flags & LYS_SET_MAX) {
                 if (rpl->max) {
-                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, rpl->exts, rpl->max, NULL);
+                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, rpl->exts, rpl->max, NULL);
                 } else {
-                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", rpl->exts);
+                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", rpl->exts);
                 }
             }
         } else if (elem->mod == LYS_DEV_DELETE) {
@@ -2058,7 +2058,7 @@
         yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->imports[u].exts, NULL, 0);
         ypr_substmt(ctx, LYEXT_SUBSTMT_PREFIX, 0, modp->imports[u].prefix, modp->imports[u].exts);
         if (modp->imports[u].rev[0]) {
-            ypr_substmt(ctx, LYEXT_SUBSTMT_REVISIONDATE, 0, modp->imports[u].rev, modp->imports[u].exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_REVISION_DATE, 0, modp->imports[u].rev, modp->imports[u].exts);
         }
         ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, modp->imports[u].dsc, modp->imports[u].exts);
         ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, modp->imports[u].ref, modp->imports[u].exts);
@@ -2075,7 +2075,7 @@
             LEVEL++;
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->includes[u].exts, NULL, 0);
             if (modp->includes[u].rev[0]) {
-                ypr_substmt(ctx, LYEXT_SUBSTMT_REVISIONDATE, 0, modp->includes[u].rev, modp->includes[u].exts);
+                ypr_substmt(ctx, LYEXT_SUBSTMT_REVISION_DATE, 0, modp->includes[u].rev, modp->includes[u].exts);
             }
             ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, modp->includes[u].dsc, modp->includes[u].exts);
             ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, modp->includes[u].ref, modp->includes[u].exts);
@@ -2154,7 +2154,7 @@
 
     /* module-header-stmts */
     if (modp->version) {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_VERSION, 0, modp->version == LYS_VERSION_1_1 ? "1.1" : "1", modp->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_YANG_VERSION, 0, modp->version == LYS_VERSION_1_1 ? "1.1" : "1", modp->exts);
     }
 
     ypr_substmt(ctx, LYEXT_SUBSTMT_NAMESPACE, 0, module->ns, modp->exts);
@@ -2194,7 +2194,7 @@
 {
     ly_print_(ctx->out, "%*sbelongs-to %s {\n", INDENT, submodp->mod->name);
     LEVEL++;
-    yprp_extension_instances(ctx, LYEXT_SUBSTMT_BELONGSTO, 0, submodp->exts, NULL, 0);
+    yprp_extension_instances(ctx, LYEXT_SUBSTMT_BELONGS_TO, 0, submodp->exts, NULL, 0);
     ypr_substmt(ctx, LYEXT_SUBSTMT_PREFIX, 0, submodp->prefix, submodp->exts);
     LEVEL--;
     ly_print_(ctx->out, "%*s}\n", INDENT);
@@ -2211,7 +2211,7 @@
 
     /* submodule-header-stmts */
     if (submodp->version) {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_VERSION, 0, submodp->version == LYS_VERSION_1_1 ? "1.1" : "1", submodp->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_YANG_VERSION, 0, submodp->version == LYS_VERSION_1_1 ? "1.1" : "1", submodp->exts);
     }
 
     yprp_belongsto(ctx, submodp);
diff --git a/src/printer_yin.c b/src/printer_yin.c
index 3db8433..c0bc7ac 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -100,11 +100,11 @@
         return;
     }
 
-    if (ext_substmt_info[substmt].flags & SUBST_FLAG_YIN) {
+    if (stmt_attr_info[substmt].flags & STMT_FLAG_YIN) {
         extflag = 1;
-        ypr_open(ctx, ext_substmt_info[substmt].name, NULL, NULL, extflag);
+        ypr_open(ctx, stmt_attr_info[substmt].name, NULL, NULL, extflag);
     } else {
-        ypr_open(ctx, ext_substmt_info[substmt].name, ext_substmt_info[substmt].arg, text, extflag);
+        ypr_open(ctx, stmt_attr_info[substmt].name, stmt_attr_info[substmt].arg, text, extflag);
     }
 
     LEVEL++;
@@ -116,12 +116,12 @@
     }
 
     /* argument as yin-element */
-    if (ext_substmt_info[substmt].flags & SUBST_FLAG_YIN) {
-        ypr_yin_arg(ctx, ext_substmt_info[substmt].arg, text);
+    if (stmt_attr_info[substmt].flags & STMT_FLAG_YIN) {
+        ypr_yin_arg(ctx, stmt_attr_info[substmt].arg, text);
     }
 
     LEVEL--;
-    ypr_close(ctx, ext_substmt_info[substmt].name, extflag);
+    ypr_close(ctx, stmt_attr_info[substmt].name, extflag);
 }
 
 static void
@@ -236,7 +236,7 @@
         /* extensions */
         LEVEL++;
         LY_ARRAY_FOR(exts, v) {
-            yprp_extension_instances(ctx, LYEXT_SUBSTMT_IFFEATURE, u, &exts[v], &extflag, 1);
+            yprp_extension_instances(ctx, LYEXT_SUBSTMT_IF_FEATURE, u, &exts[v], &extflag, 1);
         }
         LEVEL--;
         ly_print_(ctx->out, "\"/>\n");
@@ -270,9 +270,9 @@
             }
         }
         if ((ext->flags & LYS_YINELEM_MASK) ||
-                (ext->exts && (lysp_ext_instance_iter(ext->exts, 0, LYEXT_SUBSTMT_YINELEM) != LY_ARRAY_COUNT(ext->exts)))) {
+                (ext->exts && (lysp_ext_instance_iter(ext->exts, 0, LYEXT_SUBSTMT_YIN_ELEMENT) != LY_ARRAY_COUNT(ext->exts)))) {
             ypr_close_parent(ctx, &flag2);
-            ypr_substmt(ctx, LYEXT_SUBSTMT_YINELEM, 0, (ext->flags & LYS_YINELEM_TRUE) ? "true" : "false", ext->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_YIN_ELEMENT, 0, (ext->flags & LYS_YINELEM_TRUE) ? "true" : "false", ext->exts);
         }
         LEVEL--;
         ypr_close(ctx, "argument", flag2);
@@ -352,11 +352,11 @@
     }
     if (restr->emsg) {
         ypr_close_parent(ctx, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRMSG, 0, restr->emsg, restr->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_MESSAGE, 0, restr->emsg, restr->exts);
     }
     if (restr->eapptag) {
         ypr_close_parent(ctx, &inner_flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ERRTAG, 0, restr->eapptag, restr->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ERROR_APP_TAG, 0, restr->eapptag, restr->exts);
     }
     ypr_description(ctx, restr->dsc, restr->exts, &inner_flag);
     ypr_reference(ctx, restr->ref, restr->exts, &inner_flag);
@@ -459,11 +459,11 @@
     }
     if (type->flags & LYS_SET_REQINST) {
         ypr_close_parent(ctx, &flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_REQINSTANCE, 0, type->require_instance ? "true" : "false", type->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_REQUIRE_INSTANCE, 0, type->require_instance ? "true" : "false", type->exts);
     }
     if (type->flags & LYS_SET_FRDIGITS) {
         ypr_close_parent(ctx, &flag);
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_FRACDIGITS, 0, type->exts, type->fraction_digits);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_FRACTION_DIGITS, 0, type->exts, type->fraction_digits);
     }
     LY_ARRAY_FOR(type->bases, u) {
         ypr_close_parent(ctx, &flag);
@@ -827,18 +827,18 @@
     ypr_config(ctx, node->flags, node->exts, NULL);
 
     if (llist->flags & LYS_SET_MIN) {
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, llist->exts, llist->min);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, llist->exts, llist->min);
     }
     if (llist->flags & LYS_SET_MAX) {
         if (llist->max) {
-            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, llist->exts, llist->max);
+            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, llist->exts, llist->max);
         } else {
-            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", llist->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", llist->exts);
         }
     }
 
     if (llist->flags & LYS_ORDBY_MASK) {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDEREDBY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDERED_BY, 0, (llist->flags & LYS_ORDBY_USER) ? "user" : "system", llist->exts);
     }
 
     ypr_status(ctx, node->flags, node->exts, &flag);
@@ -878,19 +878,19 @@
     ypr_config(ctx, node->flags, node->exts, NULL);
 
     if (list->flags & LYS_SET_MIN) {
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, list->exts, list->min);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, list->exts, list->min);
     }
     if (list->flags & LYS_SET_MAX) {
         if (list->max) {
-            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, list->exts, list->max);
+            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, list->exts, list->max);
         } else {
-            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", list->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", list->exts);
         }
     }
 
     if (list->flags & LYS_ORDBY_MASK) {
         ypr_close_parent(ctx, &flag);
-        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDEREDBY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_ORDERED_BY, 0, (list->flags & LYS_ORDBY_USER) ? "user" : "system", list->exts);
     }
 
     ypr_status(ctx, node->flags, node->exts, &flag);
@@ -958,14 +958,14 @@
 
     if (refine->flags & LYS_SET_MIN) {
         ypr_close_parent(ctx, &flag);
-        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, refine->exts, refine->min);
+        ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, refine->exts, refine->min);
     }
     if (refine->flags & LYS_SET_MAX) {
         ypr_close_parent(ctx, &flag);
         if (refine->max) {
-            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, refine->exts, refine->max);
+            ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, refine->exts, refine->max);
         } else {
-            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", refine->exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", refine->exts);
         }
     }
 
@@ -1135,13 +1135,13 @@
             ypr_config(ctx, add->flags, add->exts, NULL);
             ypr_mandatory(ctx, add->flags, add->exts, NULL);
             if (add->flags & LYS_SET_MIN) {
-                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, add->exts, add->min);
+                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, add->exts, add->min);
             }
             if (add->flags & LYS_SET_MAX) {
                 if (add->max) {
-                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, add->exts, add->max);
+                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, add->exts, add->max);
                 } else {
-                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", add->exts);
+                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", add->exts);
                 }
             }
         } else if (elem->mod == LYS_DEV_REPLACE) {
@@ -1158,13 +1158,13 @@
             ypr_config(ctx, rpl->flags, rpl->exts, NULL);
             ypr_mandatory(ctx, rpl->flags, rpl->exts, NULL);
             if (rpl->flags & LYS_SET_MIN) {
-                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN, 0, rpl->exts, rpl->min);
+                ypr_unsigned(ctx, LYEXT_SUBSTMT_MIN_ELEMENTS, 0, rpl->exts, rpl->min);
             }
             if (rpl->flags & LYS_SET_MAX) {
                 if (rpl->max) {
-                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX, 0, rpl->exts, rpl->max);
+                    ypr_unsigned(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, rpl->exts, rpl->max);
                 } else {
-                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX, 0, "unbounded", rpl->exts);
+                    ypr_substmt(ctx, LYEXT_SUBSTMT_MAX_ELEMENTS, 0, "unbounded", rpl->exts);
                 }
             }
         } else if (elem->mod == LYS_DEV_DELETE) {
@@ -1210,84 +1210,6 @@
     }
 }
 
-struct ext_substmt_info_s stmt_attr_info[] = {
-    {NULL,               NULL,          0},             /**< LY_STMT_NONE*/
-    {"status",           "value",       SUBST_FLAG_ID}, /**< LY_STMT_STATUS */
-    {"config",           "value",       SUBST_FLAG_ID}, /**< LY_STMT_CONFIG */
-    {"mandatory",        "value",       SUBST_FLAG_ID}, /**< LY_STMT_MANDATORY */
-    {"units",            "name",        SUBST_FLAG_ID}, /**< LY_STMT_UNITS */
-    {"default",          "value",       SUBST_FLAG_ID}, /**< LY_STMT_DEFAULT */
-    {"type",             "name",        SUBST_FLAG_ID}, /**< LY_STMT_TYPE */
-    {"action",           "name",        SUBST_FLAG_ID}, /**< LY_STMT_ACTION */
-    {"anydata",          "name",        SUBST_FLAG_ID}, /**< LY_STMT_ANYDATA */
-    {"anyxml",           "name",        SUBST_FLAG_ID}, /**< LY_STMT_ANYXML */
-    {"argument",         "name",        SUBST_FLAG_ID}, /**< LY_STMT_ARGUMENT */
-    {"augment",          "target-node", SUBST_FLAG_ID}, /**< LY_STMT_AUGMENT */
-    {"base",             "name",        SUBST_FLAG_ID}, /**< LY_STMT_BASE */
-    {"belongs-to",       "module",      SUBST_FLAG_ID}, /**< LY_STMT_BELONGS_TO */
-    {"bit",              "name",        SUBST_FLAG_ID}, /**< LY_STMT_BIT */
-    {"case",             "name",        SUBST_FLAG_ID}, /**< LY_STMT_CASE */
-    {"choice",           "name",        SUBST_FLAG_ID}, /**< LY_STMT_CHOICE */
-    {"contact",          "text",        SUBST_FLAG_YIN},/**< LY_STMT_CONTACT */
-    {"container",        "name",        SUBST_FLAG_ID}, /**< LY_STMT_CONTAINER */
-    {"description",      "text",        SUBST_FLAG_YIN},/**< LY_STMT_DESCRIPTION */
-    {"deviate",          "value",       SUBST_FLAG_ID}, /**< LY_STMT_DEVIATE */
-    {"deviation",        "target-node", SUBST_FLAG_ID}, /**< LY_STMT_DEVIATION */
-    {"enum",             "name",        SUBST_FLAG_ID}, /**< LY_STMT_ENUM */
-    {"error-app-tag",    "value",       SUBST_FLAG_ID}, /**< LY_STMT_ERROR_APP_TAG */
-    {"error-message",    "value",       SUBST_FLAG_YIN},/**< LY_STMT_ERROR_MESSAGE */
-    {"extension",        "name",        SUBST_FLAG_ID}, /**< LY_STMT_EXTENSION */
-    {"feature",          "name",        SUBST_FLAG_ID}, /**< LY_STMT_FEATURE */
-    {"fraction-digits",  "value",       SUBST_FLAG_ID}, /**< LY_STMT_FRACTION_DIGITS */
-    {"grouping",         "name",        SUBST_FLAG_ID}, /**< LY_STMT_GROUPING */
-    {"identity",         "name",        SUBST_FLAG_ID}, /**< LY_STMT_IDENTITY */
-    {"if-feature",       "name",        SUBST_FLAG_ID}, /**< LY_STMT_IF_FEATURE */
-    {"import",           "module",      SUBST_FLAG_ID}, /**< LY_STMT_IMPORT */
-    {"include",          "module",      SUBST_FLAG_ID}, /**< LY_STMT_INCLUDE */
-    {"input",            NULL,          0},             /**< LY_STMT_INPUT */
-    {"key",              "value",       SUBST_FLAG_ID}, /**< LY_STMT_KEY */
-    {"leaf",             "name",        SUBST_FLAG_ID}, /**< LY_STMT_LEAF */
-    {"leaf-list",        "name",        SUBST_FLAG_ID}, /**< LY_STMT_LEAF_LIST */
-    {"length",           "value",       SUBST_FLAG_ID}, /**< LY_STMT_LENGTH */
-    {"list",             "name",        SUBST_FLAG_ID}, /**< LY_STMT_LIST */
-    {"max-elements",     "value",       SUBST_FLAG_ID}, /**< LY_STMT_MAX_ELEMENTS */
-    {"min-elements",     "value",       SUBST_FLAG_ID}, /**< LY_STMT_MIN_ELEMENTS */
-    {"modifier",         "value",       SUBST_FLAG_ID}, /**< LY_STMT_MODIFIER */
-    {"module",           "name",        SUBST_FLAG_ID}, /**< LY_STMT_MODULE */
-    {"must",             "condition",   SUBST_FLAG_ID}, /**< LY_STMT_MUST */
-    {"namespace",        "uri",         SUBST_FLAG_ID}, /**< LY_STMT_NAMESPACE */
-    {"notification",     "name",        SUBST_FLAG_ID}, /**< LY_STMT_NOTIFICATION */
-    {"ordered-by",       "value",       SUBST_FLAG_ID}, /**< LY_STMT_ORDERED_BY */
-    {"organization",     "text",        SUBST_FLAG_YIN},/**< LY_STMT_ORGANIZATION */
-    {"output",           NULL,          0},             /**< LY_STMT_OUTPUT */
-    {"path",             "value",       SUBST_FLAG_ID}, /**< LY_STMT_PATH */
-    {"pattern",          "value",       SUBST_FLAG_ID}, /**< LY_STMT_PATTERN */
-    {"position",         "value",       SUBST_FLAG_ID}, /**< LY_STMT_POSITION */
-    {"prefix",           "value",       SUBST_FLAG_ID}, /**< LY_STMT_PREFIX */
-    {"presence",         "value",       SUBST_FLAG_ID}, /**< LY_STMT_PRESENCE */
-    {"range",            "value",       SUBST_FLAG_ID}, /**< LY_STMT_RANGE */
-    {"reference",        "text",        SUBST_FLAG_YIN},/**< LY_STMT_REFERENCE */
-    {"refine",           "target-node", SUBST_FLAG_ID}, /**< LY_STMT_REFINE */
-    {"require-instance", "value",       SUBST_FLAG_ID}, /**< LY_STMT_REQUIRE_INSTANCE */
-    {"revision",         "date",        SUBST_FLAG_ID}, /**< LY_STMT_REVISION */
-    {"revision-date",    "date",        SUBST_FLAG_ID}, /**< LY_STMT_REVISION_DATE */
-    {"rpc",              "name",        SUBST_FLAG_ID}, /**< LY_STMT_RPC */
-    {"submodule",        "name",        SUBST_FLAG_ID}, /**< LY_STMT_SUBMODULE */
-    {"typedef",          "name",        SUBST_FLAG_ID}, /**< LY_STMT_TYPEDEF */
-    {"unique",           "tag",         SUBST_FLAG_ID}, /**< LY_STMT_UNIQUE */
-    {"uses",             "name",        SUBST_FLAG_ID}, /**< LY_STMT_USES */
-    {"value",            "value",       SUBST_FLAG_ID}, /**< LY_STMT_VALUE */
-    {"when",             "condition",   SUBST_FLAG_ID}, /**< LY_STMT_WHEN */
-    {"yang-version",     "value",       SUBST_FLAG_ID}, /**< LY_STMT_YANG_VERSION */
-    {"yin-element",      "value",       SUBST_FLAG_ID}, /**< LY_STMT_YIN_ELEMENT */
-    {NULL,               NULL,          0},             /**< LY_STMT_EXTENSION_INSTANCE */
-    {NULL,               NULL,          0},             /**< LY_STMT_SYNTAX_SEMICOLON */
-    {NULL,               NULL,          0},             /**< LY_STMT_SYNTAX_LEFT_BRACE */
-    {NULL,               NULL,          0},             /**< LY_STMT_SYNTAX_RIGHT_BRACE */
-    {NULL,               NULL,          0},             /**< LY_STMT_ARG_TEXT */
-    {NULL,               NULL,          0},             /**< LY_STMT_ARG_VALUE */
-};
-
 static void
 yprp_stmt(struct ypr_ctx *ctx, struct lysp_stmt *stmt)
 {
@@ -1299,7 +1221,7 @@
              cannot find the compiled information, so it is needed to be done,
              currently it is ignored */
     if (stmt_attr_info[stmt->kw].name) {
-        if (stmt_attr_info[stmt->kw].flags & SUBST_FLAG_YIN) {
+        if (stmt_attr_info[stmt->kw].flags & STMT_FLAG_YIN) {
             ypr_open(ctx, stmt->stmt, NULL, NULL, flag);
             ypr_yin_arg(ctx, stmt_attr_info[stmt->kw].arg, stmt->arg);
         } else {
@@ -1402,7 +1324,7 @@
         yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->imports[u].exts, NULL, 0);
         ypr_substmt(ctx, LYEXT_SUBSTMT_PREFIX, 0, modp->imports[u].prefix, modp->imports[u].exts);
         if (modp->imports[u].rev[0]) {
-            ypr_substmt(ctx, LYEXT_SUBSTMT_REVISIONDATE, 0, modp->imports[u].rev, modp->imports[u].exts);
+            ypr_substmt(ctx, LYEXT_SUBSTMT_REVISION_DATE, 0, modp->imports[u].rev, modp->imports[u].exts);
         }
         ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, modp->imports[u].dsc, modp->imports[u].exts);
         ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, modp->imports[u].ref, modp->imports[u].exts);
@@ -1419,7 +1341,7 @@
             LEVEL++;
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->includes[u].exts, NULL, 0);
             if (modp->includes[u].rev[0]) {
-                ypr_substmt(ctx, LYEXT_SUBSTMT_REVISIONDATE, 0, modp->includes[u].rev, modp->includes[u].exts);
+                ypr_substmt(ctx, LYEXT_SUBSTMT_REVISION_DATE, 0, modp->includes[u].rev, modp->includes[u].exts);
             }
             ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, modp->includes[u].dsc, modp->includes[u].exts);
             ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, modp->includes[u].ref, modp->includes[u].exts);
@@ -1503,7 +1425,7 @@
 
     /* module-header-stmts */
     if (modp->version) {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_VERSION, 0, modp->version == LYS_VERSION_1_1 ? "1.1" : "1", modp->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_YANG_VERSION, 0, modp->version == LYS_VERSION_1_1 ? "1.1" : "1", modp->exts);
     }
     ypr_substmt(ctx, LYEXT_SUBSTMT_NAMESPACE, 0, module->ns, modp->exts);
     ypr_substmt(ctx, LYEXT_SUBSTMT_PREFIX, 0, module->prefix, modp->exts);
@@ -1543,7 +1465,7 @@
 {
     ypr_open(ctx, "belongs-to", "module", submodp->mod->name, 1);
     LEVEL++;
-    yprp_extension_instances(ctx, LYEXT_SUBSTMT_BELONGSTO, 0, submodp->exts, NULL, 0);
+    yprp_extension_instances(ctx, LYEXT_SUBSTMT_BELONGS_TO, 0, submodp->exts, NULL, 0);
     ypr_substmt(ctx, LYEXT_SUBSTMT_PREFIX, 0, submodp->prefix, submodp->exts);
     LEVEL--;
     ypr_close(ctx, "belongs-to", 1);
@@ -1565,7 +1487,7 @@
 
     /* submodule-header-stmts */
     if (submodp->version) {
-        ypr_substmt(ctx, LYEXT_SUBSTMT_VERSION, 0, submodp->version == LYS_VERSION_1_1 ? "1.1" : "1", submodp->exts);
+        ypr_substmt(ctx, LYEXT_SUBSTMT_YANG_VERSION, 0, submodp->version == LYS_VERSION_1_1 ? "1.1" : "1", submodp->exts);
     }
     yprp_belongsto(ctx, submodp);
 
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 7d056c9..831a055 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -47,6 +47,94 @@
 #include "tree_schema_internal.h"
 #include "xpath.h"
 
+/**
+ * @brief information about YANG statements
+ */
+struct stmt_info_s stmt_attr_info[] = {
+    {NULL,               NULL,          0},            /**< LY_STMT_NONE */
+    {"action",           "name",        STMT_FLAG_ID}, /**< LY_STMT_ACTION */
+    {"anydata",          "name",        STMT_FLAG_ID}, /**< LY_STMT_ANYDATA */
+    {"anyxml",           "name",        STMT_FLAG_ID}, /**< LY_STMT_ANYXML */
+    {"argument",         "name",        STMT_FLAG_ID}, /**< LY_STMT_ARGUMENT */
+    {"text",             NULL,          0},            /**< LY_STMT_ARG_TEXT */
+    {"value",            NULL,          0},            /**< LY_STMT_ARG_VALUE */
+    {"augment",          "target-node", STMT_FLAG_ID}, /**< LY_STMT_AUGMENT */
+    {"base",             "name",        STMT_FLAG_ID}, /**< LY_STMT_BASE */
+    {"belongs-to",       "module",      STMT_FLAG_ID}, /**< LY_STMT_BELONGS_TO */
+    {"bit",              "name",        STMT_FLAG_ID}, /**< LY_STMT_BIT */
+    {"case",             "name",        STMT_FLAG_ID}, /**< LY_STMT_CASE */
+    {"choice",           "name",        STMT_FLAG_ID}, /**< LY_STMT_CHOICE */
+    {"config",           "value",       STMT_FLAG_ID}, /**< LY_STMT_CONFIG */
+    {"contact",          "text",        STMT_FLAG_YIN},/**< LY_STMT_CONTACT */
+    {"container",        "name",        STMT_FLAG_ID}, /**< LY_STMT_CONTAINER */
+    {"default",          "value",       0},            /**< LY_STMT_DEFAULT */
+    {"description",      "text",        STMT_FLAG_YIN},/**< LY_STMT_DESCRIPTION */
+    {"deviate",          "value",       STMT_FLAG_ID}, /**< LY_STMT_DEVIATE */
+    {"deviation",        "target-node", STMT_FLAG_ID}, /**< LY_STMT_DEVIATION */
+    {"enum",             "name",        STMT_FLAG_ID}, /**< LY_STMT_ENUM */
+    {"error-app-tag",    "value",       0},            /**< LY_STMT_ERRTAG */
+    {"error-message",    "value",       STMT_FLAG_YIN},/**< LY_STMT_ERRMSG */
+    {"extension",        "name",        STMT_FLAG_ID}, /**< LY_STMT_EXTENSION */
+    {NULL,               NULL,          0},            /**< LY_STMT_EXTENSION_INSTANCE */
+    {"feature",          "name",        STMT_FLAG_ID}, /**< LY_STMT_FEATURE */
+    {"fraction-digits",  "value",       STMT_FLAG_ID}, /**< LY_STMT_FRACTION_DIGITS */
+    {"grouping",         "name",        STMT_FLAG_ID}, /**< LY_STMT_GROUPING */
+    {"identity",         "name",        STMT_FLAG_ID}, /**< LY_STMT_IDENTITY */
+    {"if-feature",       "name",        0},            /**< LY_STMT_IF_FEATURE */
+    {"import",           "module",      STMT_FLAG_ID}, /**< LY_STMT_IMPORT */
+    {"include",          "module",      STMT_FLAG_ID}, /**< LY_STMT_INCLUDE */
+    {"input",            NULL,          0},            /**< LY_STMT_INPUT */
+    {"key",              "value",       0},            /**< LY_STMT_KEY */
+    {"leaf",             "name",        STMT_FLAG_ID}, /**< LY_STMT_LEAF */
+    {"leaf-list",        "name",        STMT_FLAG_ID}, /**< LY_STMT_LEAF_LIST */
+    {"length",           "value",       0},            /**< LY_STMT_LENGTH */
+    {"list",             "name",        STMT_FLAG_ID}, /**< LY_STMT_LIST */
+    {"mandatory",        "value",       STMT_FLAG_ID}, /**< LY_STMT_MANDATORY */
+    {"max-elements",     "value",       STMT_FLAG_ID}, /**< LY_STMT_MAX_ELEMENTS */
+    {"min-elements",     "value",       STMT_FLAG_ID}, /**< LY_STMT_MIN_ELEMENTS */
+    {"modifier",         "value",       STMT_FLAG_ID}, /**< LY_STMT_MODIFIER */
+    {"module",           "name",        STMT_FLAG_ID}, /**< LY_STMT_MODULE */
+    {"must",             "condition",   0},            /**< LY_STMT_MUST */
+    {"namespace",        "uri",         0},            /**< LY_STMT_NAMESPACE */
+    {"notification",     "name",        STMT_FLAG_ID}, /**< LY_STMT_NOTIFICATION */
+    {"ordered-by",       "value",       STMT_FLAG_ID}, /**< LY_STMT_ORDERED_BY */
+    {"organization",     "text",        STMT_FLAG_YIN},/**< LY_STMT_ORGANIZATION */
+    {"output",           NULL,          0},            /**< LY_STMT_OUTPUT */
+    {"path",             "value",       0},            /**< LY_STMT_PATH */
+    {"pattern",          "value",       0},            /**< LY_STMT_PATTERN */
+    {"position",         "value",       STMT_FLAG_ID}, /**< LY_STMT_POSITION */
+    {"prefix",           "value",       STMT_FLAG_ID}, /**< LY_STMT_PREFIX */
+    {"presence",         "value",       0},            /**< LY_STMT_PRESENCE */
+    {"range",            "value",       0},            /**< LY_STMT_RANGE */
+    {"reference",        "text",        STMT_FLAG_YIN},/**< LY_STMT_REFERENCE */
+    {"refine",           "target-node", STMT_FLAG_ID}, /**< LY_STMT_REFINE */
+    {"require-instance", "value",       STMT_FLAG_ID}, /**< LY_STMT_REQUIRE_INSTANCE */
+    {"revision",         "date",        STMT_FLAG_ID}, /**< LY_STMT_REVISION */
+    {"revision-date",    "date",        STMT_FLAG_ID}, /**< LY_STMT_REVISION_DATE */
+    {"rpc",              "name",        STMT_FLAG_ID}, /**< LY_STMT_RPC */
+    {"status",           "value",       STMT_FLAG_ID}, /**< LY_STMT_STATUS */
+    {"submodule",        "name",        STMT_FLAG_ID}, /**< LY_STMT_SUBMODULE */
+    {"{",                NULL,          0},            /**< LY_STMT_SYNTAX_LEFT_BRACE */
+    {"}",                NULL,          0},            /**< LY_STMT_SYNTAX_RIGHT_BRACE */
+    {";",                NULL,          0},            /**< LY_STMT_SYNTAX_SEMICOLON */
+    {"type",             "name",        STMT_FLAG_ID}, /**< LY_STMT_TYPE */
+    {"typedef",          "name",        STMT_FLAG_ID}, /**< LY_STMT_TYPEDEF */
+    {"unique",           "tag",         0},            /**< LY_STMT_UNIQUE */
+    {"units",            "name",        0},            /**< LY_STMT_UNITS */
+    {"uses",             "name",        STMT_FLAG_ID}, /**< LY_STMT_USES */
+    {"value",            "value",       STMT_FLAG_ID}, /**< LY_STMT_VALUE */
+    {"when",             "condition",   0},            /**< LY_STMT_WHEN */
+    {"yang-version",     "value",       STMT_FLAG_ID}, /**< LY_STMT_YANG_VERSION */
+    {"yin-element",      "value",       STMT_FLAG_ID}, /**< LY_STMT_YIN_ELEMENT */
+};
+
+const char * const ly_devmod_list[] = {
+    [LYS_DEV_NOT_SUPPORTED] = "not-supported",
+    [LYS_DEV_ADD] = "add",
+    [LYS_DEV_DELETE] = "delete",
+    [LYS_DEV_REPLACE] = "replace",
+};
+
 API LY_ERR
 lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data)
 {
diff --git a/src/tree_schema.h b/src/tree_schema.h
index e9f069a..0f611f4 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -255,27 +255,32 @@
  */
 enum ly_stmt {
     LY_STMT_NONE = 0,
-    LY_STMT_STATUS,             /**< in ::lysc_ext_substmt.storage stored as a pointer to `uint16_t`, only cardinality < #LY_STMT_CARD_SOME is allowed */
-    LY_STMT_CONFIG,             /**< in ::lysc_ext_substmt.storage stored as a pointer to `uint16_t`, only cardinality < #LY_STMT_CARD_SOME is allowed */
-    LY_STMT_MANDATORY,
-    LY_STMT_UNITS,              /**< in ::lysc_ext_substmt.storage stored as a pointer to `const char *` (cardinality < #LY_STMT_CARD_SOME)
-                                     or as a pointer to a [sized array](@ref sizedarrays) `const char **` */
-    LY_STMT_DEFAULT,
-    LY_STMT_TYPE,               /**< in ::lysc_ext_substmt.storage stored as a pointer to `struct lysc_type *` (cardinality < #LY_STMT_CARD_SOME)
-                                     or as a pointer to a [sized array](@ref sizedarrays) `struct lysc_type **` */
-
-    LY_STMT_ACTION,
-    LY_STMT_ANYDATA,
-    LY_STMT_ANYXML,
+    LY_STMT_ACTION,             /**< in ::lysc_ext_substmt.storage stored as a pointer to linked list of `struct lysc_node_action *`.
+                                     Note that due to compatibility with `struct lysc_node *`, the compiled actions can be actually
+                                     mixed in the linked list with other ::lysc_node based nodes if the storage is shared. */
+    LY_STMT_ANYDATA,            /**< in ::lysc_ext_substmt.storage stored as a pointer to linked list of `struct lysc_node *`.
+                                     Note that due to ::lysc_node compatibility the anydata can be actually mixed in
+                                     the linked list with other ::lysc_node based nodes if the storage is shared. */
+    LY_STMT_ANYXML,             /**< in ::lysc_ext_substmt.storage stored as a pointer to linked list of `struct lysc_node *`.
+                                     Note that due to ::lysc_node compatibility the anyxml can be actually mixed in
+                                     the linked list with other ::lysc_node based nodes if the storage is shared. */
     LY_STMT_ARGUMENT,
+    LY_STMT_ARG_TEXT,
+    LY_STMT_ARG_VALUE,
     LY_STMT_AUGMENT,
     LY_STMT_BASE,
     LY_STMT_BELONGS_TO,
     LY_STMT_BIT,
-    LY_STMT_CASE,
-    LY_STMT_CHOICE,
+    LY_STMT_CASE,               /**< TODO is it possible to compile cases without the parent choice? */
+    LY_STMT_CHOICE,             /**< in ::lysc_ext_substmt.storage stored as a pointer to linked list of `struct lysc_node *`.
+                                     Note that due to ::lysc_node compatibility the choice can be actually mixed in
+                                     the linked list with other ::lysc_node based nodes if the storage is shared. */
+    LY_STMT_CONFIG,             /**< in ::lysc_ext_substmt.storage stored as a pointer to `uint16_t`, only cardinality < #LY_STMT_CARD_SOME is allowed */
     LY_STMT_CONTACT,
-    LY_STMT_CONTAINER,
+    LY_STMT_CONTAINER,          /**< in ::lysc_ext_substmt.storage stored as a pointer to linked list of `struct lysc_node *`.
+                                     Note that due to ::lysc_node compatibility the container can be actually mixed in
+                                     the linked list with other ::lysc_node based nodes if the storage is shared. */
+    LY_STMT_DEFAULT,
     LY_STMT_DESCRIPTION,
     LY_STMT_DEVIATE,
     LY_STMT_DEVIATION,
@@ -283,6 +288,7 @@
     LY_STMT_ERROR_APP_TAG,
     LY_STMT_ERROR_MESSAGE,
     LY_STMT_EXTENSION,
+    LY_STMT_EXTENSION_INSTANCE,
     LY_STMT_FEATURE,
     LY_STMT_FRACTION_DIGITS,
     LY_STMT_GROUPING,
@@ -296,7 +302,10 @@
     LY_STMT_LEAF,
     LY_STMT_LEAF_LIST,
     LY_STMT_LENGTH,
-    LY_STMT_LIST,
+    LY_STMT_LIST,               /**< in ::lysc_ext_substmt.storage stored as a pointer to linked list of `struct lysc_node *`.
+                                     Note that due to ::lysc_node compatibility the list can be actually mixed in
+                                     the linked list with other ::lysc_node based nodes if the storage is shared. */
+    LY_STMT_MANDATORY,          /**< in ::lysc_ext_substmt.storage stored as a pointer to `uint16_t`, only cardinality < #LY_STMT_CARD_SOME is allowed */
     LY_STMT_MAX_ELEMENTS,
     LY_STMT_MIN_ELEMENTS,
     LY_STMT_MODIFIER,
@@ -318,23 +327,25 @@
     LY_STMT_REQUIRE_INSTANCE,
     LY_STMT_REVISION,
     LY_STMT_REVISION_DATE,
-    LY_STMT_RPC,
+    LY_STMT_RPC,                /**< in ::lysc_ext_substmt.storage stored as a pointer to linked list of `struct lysc_node_action *`.
+                                     Note that due to compatibility with `struct lysc_node *`, the compiled RPCs can be actually
+                                     mixed in the linked list with other ::lysc_node based nodes if the storage is shared. */
+    LY_STMT_STATUS,             /**< in ::lysc_ext_substmt.storage stored as a pointer to `uint16_t`, only cardinality < #LY_STMT_CARD_SOME is allowed */
     LY_STMT_SUBMODULE,
+    LY_STMT_SYNTAX_SEMICOLON,
+    LY_STMT_SYNTAX_LEFT_BRACE,
+    LY_STMT_SYNTAX_RIGHT_BRACE,
+    LY_STMT_TYPE,               /**< in ::lysc_ext_substmt.storage stored as a pointer to `struct lysc_type *` (cardinality < #LY_STMT_CARD_SOME)
+                                     or as a pointer to a [sized array](@ref sizedarrays) `struct lysc_type **` */
     LY_STMT_TYPEDEF,
     LY_STMT_UNIQUE,
+    LY_STMT_UNITS,              /**< in ::lysc_ext_substmt.storage stored as a pointer to `const char *` (cardinality < #LY_STMT_CARD_SOME)
+                                     or as a pointer to a [sized array](@ref sizedarrays) `const char **` */
     LY_STMT_USES,
     LY_STMT_VALUE,
     LY_STMT_WHEN,
     LY_STMT_YANG_VERSION,
-    LY_STMT_YIN_ELEMENT,
-    LY_STMT_EXTENSION_INSTANCE,
-
-    LY_STMT_SYNTAX_SEMICOLON,
-    LY_STMT_SYNTAX_LEFT_BRACE,
-    LY_STMT_SYNTAX_RIGHT_BRACE,
-
-    LY_STMT_ARG_TEXT,
-    LY_STMT_ARG_VALUE
+    LY_STMT_YIN_ELEMENT
 };
 
 /**
@@ -378,50 +389,50 @@
  * @brief Enum of substatements in which extension instances can appear.
  */
 typedef enum {
-    LYEXT_SUBSTMT_SELF = 0,      /**< extension of the structure itself, not substatement's */
-    LYEXT_SUBSTMT_ARGUMENT,      /**< extension of the argument statement, can appear in lys_ext */
-    LYEXT_SUBSTMT_BASE,          /**< extension of the base statement, can appear (repeatedly) in lys_type and lys_ident */
-    LYEXT_SUBSTMT_BELONGSTO,     /**< extension of the belongs-to statement, can appear in lys_submodule */
-    LYEXT_SUBSTMT_CONTACT,       /**< extension of the contact statement, can appear in lys_module */
-    LYEXT_SUBSTMT_DEFAULT,       /**< extension of the default statement, can appear in lys_node_leaf, lys_node_leaflist,
-                                      lys_node_choice and lys_deviate */
-    LYEXT_SUBSTMT_DESCRIPTION,   /**< extension of the description statement, can appear in lys_module, lys_submodule,
-                                      lys_node, lys_import, lys_include, lys_ext, lys_feature, lys_tpdf, lys_restr,
-                                      lys_ident, lys_deviation, lys_type_enum, lys_type_bit, lys_when and lys_revision */
-    LYEXT_SUBSTMT_ERRTAG,        /**< extension of the error-app-tag statement, can appear in lys_restr */
-    LYEXT_SUBSTMT_ERRMSG,        /**< extension of the error-message statement, can appear in lys_restr */
-    LYEXT_SUBSTMT_KEY,           /**< extension of the key statement, can appear in lys_node_list */
-    LYEXT_SUBSTMT_NAMESPACE,     /**< extension of the namespace statement, can appear in lys_module */
-    LYEXT_SUBSTMT_ORGANIZATION,  /**< extension of the organization statement, can appear in lys_module and lys_submodule */
-    LYEXT_SUBSTMT_PATH,          /**< extension of the path statement, can appear in lys_type */
-    LYEXT_SUBSTMT_PREFIX,        /**< extension of the prefix statement, can appear in lys_module, lys_submodule (for
-                                      belongs-to's prefix) and lys_import */
-    LYEXT_SUBSTMT_PRESENCE,      /**< extension of the presence statement, can appear in lys_node_container */
-    LYEXT_SUBSTMT_REFERENCE,     /**< extension of the reference statement, can appear in lys_module, lys_submodule,
-                                      lys_node, lys_import, lys_include, lys_revision, lys_tpdf, lys_restr, lys_ident,
-                                      lys_ext, lys_feature, lys_deviation, lys_type_enum, lys_type_bit and lys_when */
-    LYEXT_SUBSTMT_REVISIONDATE,  /**< extension of the revision-date statement, can appear in lys_import and lys_include */
-    LYEXT_SUBSTMT_UNITS,         /**< extension of the units statement, can appear in lys_tpdf, lys_node_leaf,
-                                      lys_node_leaflist and lys_deviate */
-    LYEXT_SUBSTMT_VALUE,         /**< extension of the value statement, can appear in lys_type_enum */
-    LYEXT_SUBSTMT_VERSION,       /**< extension of the yang-version statement, can appear in lys_module and lys_submodule */
-    LYEXT_SUBSTMT_MODIFIER,      /**< extension of the modifier statement, can appear in lys_restr */
-    LYEXT_SUBSTMT_REQINSTANCE,   /**< extension of the require-instance statement, can appear in lys_type */
-    LYEXT_SUBSTMT_YINELEM,       /**< extension of the yin-element statement, can appear in lys_ext */
-    LYEXT_SUBSTMT_CONFIG,        /**< extension of the config statement, can appear in lys_node and lys_deviate */
-    LYEXT_SUBSTMT_MANDATORY,     /**< extension of the mandatory statement, can appear in lys_node_leaf, lys_node_choice,
-                                      lys_node_anydata and lys_deviate */
-    LYEXT_SUBSTMT_ORDEREDBY,     /**< extension of the ordered-by statement, can appear in lys_node_list and lys_node_leaflist */
-    LYEXT_SUBSTMT_STATUS,        /**< extension of the status statement, can appear in lys_tpdf, lys_node, lys_ident,
-                                      lys_ext, lys_feature, lys_type_enum and lys_type_bit */
-    LYEXT_SUBSTMT_FRACDIGITS,    /**< extension of the fraction-digits statement, can appear in lys_type */
-    LYEXT_SUBSTMT_MAX,           /**< extension of the max-elements statement, can appear in lys_node_list,
-                                      lys_node_leaflist and lys_deviate */
-    LYEXT_SUBSTMT_MIN,           /**< extension of the min-elements statement, can appear in lys_node_list,
-                                      lys_node_leaflist and lys_deviate */
-    LYEXT_SUBSTMT_POSITION,      /**< extension of the position statement, can appear in lys_type_bit */
-    LYEXT_SUBSTMT_UNIQUE,        /**< extension of the unique statement, can appear in lys_node_list and lys_deviate */
-    LYEXT_SUBSTMT_IFFEATURE      /**< extension of the if-feature statement */
+    LYEXT_SUBSTMT_SELF = 0,                              /**< extension of the structure itself, not substatement's */
+    LYEXT_SUBSTMT_ARGUMENT = LY_STMT_ARGUMENT,           /**< extension of the argument statement, can appear in lys_ext */
+    LYEXT_SUBSTMT_BASE = LY_STMT_BASE,                   /**< extension of the base statement, can appear (repeatedly) in lys_type and lys_ident */
+    LYEXT_SUBSTMT_BELONGS_TO = LY_STMT_BELONGS_TO,       /**< extension of the belongs-to statement, can appear in lys_submodule */
+    LYEXT_SUBSTMT_CONFIG = LY_STMT_CONFIG,               /**< extension of the config statement, can appear in lys_node and lys_deviate */
+    LYEXT_SUBSTMT_CONTACT = LY_STMT_CONTACT,             /**< extension of the contact statement, can appear in lys_module */
+    LYEXT_SUBSTMT_DEFAULT = LY_STMT_DEFAULT,             /**< extension of the default statement, can appear in lys_node_leaf, lys_node_leaflist,
+                                                              lys_node_choice and lys_deviate */
+    LYEXT_SUBSTMT_DESCRIPTION = LY_STMT_DESCRIPTION,     /**< extension of the description statement, can appear in lys_module, lys_submodule,
+                                                              lys_node, lys_import, lys_include, lys_ext, lys_feature, lys_tpdf, lys_restr,
+                                                              lys_ident, lys_deviation, lys_type_enum, lys_type_bit, lys_when and lys_revision */
+    LYEXT_SUBSTMT_ERROR_APP_TAG = LY_STMT_ERROR_APP_TAG, /**< extension of the error-app-tag statement, can appear in lys_restr */
+    LYEXT_SUBSTMT_ERROR_MESSAGE = LY_STMT_ERROR_MESSAGE, /**< extension of the error-message statement, can appear in lys_restr */
+    LYEXT_SUBSTMT_FRACTION_DIGITS = LY_STMT_FRACTION_DIGITS, /**< extension of the fraction-digits statement, can appear in lys_type */
+    LYEXT_SUBSTMT_IF_FEATURE = LY_STMT_IF_FEATURE,       /**< extension of the if-feature statement */
+    LYEXT_SUBSTMT_KEY = LY_STMT_KEY,                     /**< extension of the key statement, can appear in lys_node_list */
+    LYEXT_SUBSTMT_MANDATORY = LY_STMT_MANDATORY,         /**< extension of the mandatory statement, can appear in lys_node_leaf, lys_node_choice,
+                                                              lys_node_anydata and lys_deviate */
+    LYEXT_SUBSTMT_MAX_ELEMENTS = LY_STMT_MAX_ELEMENTS,   /**< extension of the max-elements statement, can appear in lys_node_list,
+                                                              lys_node_leaflist and lys_deviate */
+    LYEXT_SUBSTMT_MIN_ELEMENTS = LY_STMT_MIN_ELEMENTS,   /**< extension of the min-elements statement, can appear in lys_node_list,
+                                                              lys_node_leaflist and lys_deviate */
+    LYEXT_SUBSTMT_MODIFIER = LY_STMT_MODIFIER,           /**< extension of the modifier statement, can appear in lys_restr */
+    LYEXT_SUBSTMT_NAMESPACE = LY_STMT_NAMESPACE,         /**< extension of the namespace statement, can appear in lys_module */
+    LYEXT_SUBSTMT_ORDERED_BY = LY_STMT_ORDERED_BY,       /**< extension of the ordered-by statement, can appear in lys_node_list and lys_node_leaflist */
+    LYEXT_SUBSTMT_ORGANIZATION = LY_STMT_ORGANIZATION,   /**< extension of the organization statement, can appear in lys_module and lys_submodule */
+    LYEXT_SUBSTMT_PATH = LY_STMT_PATH,                   /**< extension of the path statement, can appear in lys_type */
+    LYEXT_SUBSTMT_POSITION = LY_STMT_POSITION,           /**< extension of the position statement, can appear in lys_type_bit */
+    LYEXT_SUBSTMT_PREFIX = LY_STMT_PREFIX,               /**< extension of the prefix statement, can appear in lys_module, lys_submodule (for
+                                                              belongs-to's prefix) and lys_import */
+    LYEXT_SUBSTMT_PRESENCE = LY_STMT_PRESENCE,           /**< extension of the presence statement, can appear in lys_node_container */
+    LYEXT_SUBSTMT_REFERENCE = LY_STMT_REFERENCE,         /**< extension of the reference statement, can appear in lys_module, lys_submodule,
+                                                              lys_node, lys_import, lys_include, lys_revision, lys_tpdf, lys_restr, lys_ident,
+                                                              lys_ext, lys_feature, lys_deviation, lys_type_enum, lys_type_bit and lys_when */
+    LYEXT_SUBSTMT_REQUIRE_INSTANCE = LY_STMT_REQUIRE_INSTANCE, /**< extension of the require-instance statement, can appear in lys_type */
+    LYEXT_SUBSTMT_REVISION_DATE = LY_STMT_REVISION_DATE, /**< extension of the revision-date statement, can appear in lys_import and lys_include */
+    LYEXT_SUBSTMT_STATUS = LY_STMT_STATUS,               /**< extension of the status statement, can appear in lys_tpdf, lys_node, lys_ident,
+                                                              lys_ext, lys_feature, lys_type_enum and lys_type_bit */
+    LYEXT_SUBSTMT_UNIQUE = LY_STMT_UNIQUE,               /**< extension of the unique statement, can appear in lys_node_list and lys_deviate */
+    LYEXT_SUBSTMT_UNITS = LY_STMT_UNITS,                 /**< extension of the units statement, can appear in lys_tpdf, lys_node_leaf,
+                                                              lys_node_leaflist and lys_deviate */
+    LYEXT_SUBSTMT_VALUE = LY_STMT_VALUE,                 /**< extension of the value statement, can appear in lys_type_enum */
+    LYEXT_SUBSTMT_YANG_VERSION = LY_STMT_YANG_VERSION,   /**< extension of the yang-version statement, can appear in lys_module and lys_submodule */
+    LYEXT_SUBSTMT_YIN_ELEMENT = LY_STMT_YIN_ELEMENT      /**< extension of the yin-element statement, can appear in lys_ext */
 } LYEXT_SUBSTMT;
 
 /**
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index 51de253..b139b69 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -35,6 +35,30 @@
 #define LY_PCRE2_MSG_LIMIT 256
 
 /**
+ * @brief Informational structure for YANG statements
+ */
+struct stmt_info_s {
+    const char *name;      /**< name of the statement */
+    const char *arg;       /**< name of YIN's attribute to present the statement */
+    uint8_t flags;         /**< various flags to clarify printing of the statement */
+#define STMT_FLAG_YIN 0x1 /**< has YIN element */
+#define STMT_FLAG_ID 0x2  /**< the value is identifier -> no quotes */
+};
+
+/* statements informations filled in tree_schema.c */
+extern struct stmt_info_s stmt_attr_info[];
+
+/* list of the YANG statements strings */
+#define ly_stmt2str(STMT) stmt_attr_info[STMT].name
+
+/* extensions' substatements (LYEXT_SUBSTMT) strings */
+#define lyext_substmt2str(STMT) stmt_attr_info[STMT].name
+
+/* list of the deviate modifications strings */
+extern const char * const ly_devmod_list[];
+#define ly_devmod2str(TYPE) ly_devmod_list[TYPE]
+
+/**
  * @brief Check module version is at least 2 (YANG 1.1) because of the keyword presence.
  * Logs error message and returns LY_EVALID in case of module in YANG version 1.0.
  * @param[in] CTX yang parser context to get current module and for logging.