tree schema common OPTIMIZE reduce lib size

Do not use large static arrays because switch
is similar in efficiency but requires a fraction
of the memory.

Fixes #1952
diff --git a/src/plugins_exts.c b/src/plugins_exts.c
index 793f493..95ac9eb 100644
--- a/src/plugins_exts.c
+++ b/src/plugins_exts.c
@@ -536,7 +536,7 @@
     if (stmt == LY_STMT_EXTENSION_INSTANCE) {
         return "extension instance";
     } else {
-        return stmt_attr_info[stmt].name;
+        return lys_stmt_str(stmt);
     }
 }
 
diff --git a/src/printer_yang.c b/src/printer_yang.c
index 0172f6b..aaf1d64 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -336,11 +336,10 @@
         return;
     }
 
-    if (stmt_attr_info[substmt].flags & STMT_FLAG_ID) {
-        ly_print_(pctx->out, "%*s%s %s", INDENT, stmt_attr_info[substmt].name, text);
+    if (lys_stmt_flags(substmt) & LY_STMT_FLAG_ID) {
+        ly_print_(pctx->out, "%*s%s %s", INDENT, lys_stmt_str(substmt), text);
     } else {
-        ypr_text(pctx, stmt_attr_info[substmt].name, text,
-                (stmt_attr_info[substmt].flags & STMT_FLAG_YIN) ? 0 : 1, 0);
+        ypr_text(pctx, lys_stmt_str(substmt), text, (lys_stmt_flags(substmt) & LY_STMT_FLAG_YIN) ? 0 : 1, 0);
     }
 
     LEVEL++;
diff --git a/src/printer_yin.c b/src/printer_yin.c
index e1d78f6..0a9312d 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -104,12 +104,12 @@
              the extension instance substatements in extension instances (LY_STMT_EXTENSION_INSTANCE)
              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 & STMT_FLAG_YIN) {
+    if (lys_stmt_str(stmt->kw)) {
+        if (lys_stmt_flags(stmt->kw) & LY_STMT_FLAG_YIN) {
             ypr_open(pctx, stmt->stmt, NULL, NULL, flag);
-            ypr_yin_arg(pctx, stmt_attr_info[stmt->kw].arg, stmt->arg);
+            ypr_yin_arg(pctx, lys_stmt_arg(stmt->kw), stmt->arg);
         } else {
-            ypr_open(pctx, stmt->stmt, stmt_attr_info[stmt->kw].arg, stmt->arg, flag);
+            ypr_open(pctx, stmt->stmt, lys_stmt_arg(stmt->kw), stmt->arg, flag);
         }
     }
 
@@ -185,23 +185,23 @@
         return;
     }
 
-    if (stmt_attr_info[substmt].flags & STMT_FLAG_YIN) {
+    if (lys_stmt_flags(substmt) & LY_STMT_FLAG_YIN) {
         extflag = 1;
-        ypr_open(pctx, stmt_attr_info[substmt].name, NULL, NULL, extflag);
+        ypr_open(pctx, lys_stmt_str(substmt), NULL, NULL, extflag);
     } else {
-        ypr_open(pctx, stmt_attr_info[substmt].name, stmt_attr_info[substmt].arg, text, extflag);
+        ypr_open(pctx, lys_stmt_str(substmt), lys_stmt_arg(substmt), text, extflag);
     }
 
     LEVEL++;
     yprp_extension_instances(pctx, substmt, substmt_index, exts, &extflag);
 
     /* argument as yin-element */
-    if (stmt_attr_info[substmt].flags & STMT_FLAG_YIN) {
-        ypr_yin_arg(pctx, stmt_attr_info[substmt].arg, text);
+    if (lys_stmt_flags(substmt) & LY_STMT_FLAG_YIN) {
+        ypr_yin_arg(pctx, lys_stmt_arg(substmt), text);
     }
 
     LEVEL--;
-    ypr_close(pctx, stmt_attr_info[substmt].name, extflag);
+    ypr_close(pctx, lys_stmt_str(substmt), extflag);
 }
 
 static void
diff --git a/src/tree_schema_common.c b/src/tree_schema_common.c
index a771f26..bbdd676 100644
--- a/src/tree_schema_common.c
+++ b/src/tree_schema_common.c
@@ -40,87 +40,6 @@
 #include "tree_schema.h"
 #include "tree_schema_internal.h"
 
-/**
- * @brief information about YANG statements
- */
-struct stmt_info_s stmt_attr_info[] = {
-    [LY_STMT_NONE] = {NULL, NULL, 0},
-    [LY_STMT_ACTION] = {"action", "name", STMT_FLAG_ID},
-    [LY_STMT_ANYDATA] = {"anydata", "name", STMT_FLAG_ID},
-    [LY_STMT_ANYXML] = {"anyxml", "name", STMT_FLAG_ID},
-    [LY_STMT_ARGUMENT] = {"argument", "name", STMT_FLAG_ID},
-    [LY_STMT_ARG_TEXT] = {"text", NULL, 0},
-    [LY_STMT_ARG_VALUE] = {"value", NULL, 0},
-    [LY_STMT_AUGMENT] = {"augment", "target-node", STMT_FLAG_ID},
-    [LY_STMT_BASE] = {"base", "name", STMT_FLAG_ID},
-    [LY_STMT_BELONGS_TO] = {"belongs-to", "module", STMT_FLAG_ID},
-    [LY_STMT_BIT] = {"bit", "name", STMT_FLAG_ID},
-    [LY_STMT_CASE] = {"case", "name", STMT_FLAG_ID},
-    [LY_STMT_CHOICE] = {"choice", "name", STMT_FLAG_ID},
-    [LY_STMT_CONFIG] = {"config", "value", STMT_FLAG_ID},
-    [LY_STMT_CONTACT] = {"contact", "text", STMT_FLAG_YIN},
-    [LY_STMT_CONTAINER] = {"container", "name", STMT_FLAG_ID},
-    [LY_STMT_DEFAULT] = {"default", "value", 0},
-    [LY_STMT_DESCRIPTION] = {"description", "text", STMT_FLAG_YIN},
-    [LY_STMT_DEVIATE] = {"deviate", "value", STMT_FLAG_ID},
-    [LY_STMT_DEVIATION] = {"deviation", "target-node", STMT_FLAG_ID},
-    [LY_STMT_ENUM] = {"enum", "name", STMT_FLAG_ID},
-    [LY_STMT_ERROR_APP_TAG] = {"error-app-tag", "value", 0},
-    [LY_STMT_ERROR_MESSAGE] = {"error-message", "value", STMT_FLAG_YIN},
-    [LY_STMT_EXTENSION] = {"extension", "name", STMT_FLAG_ID},
-    [LY_STMT_EXTENSION_INSTANCE] = {NULL, NULL, 0},
-    [LY_STMT_FEATURE] = {"feature", "name", STMT_FLAG_ID},
-    [LY_STMT_FRACTION_DIGITS] = {"fraction-digits", "value", STMT_FLAG_ID},
-    [LY_STMT_GROUPING] = {"grouping", "name", STMT_FLAG_ID},
-    [LY_STMT_IDENTITY] = {"identity", "name", STMT_FLAG_ID},
-    [LY_STMT_IF_FEATURE] = {"if-feature", "name", 0},
-    [LY_STMT_IMPORT] = {"import", "module", STMT_FLAG_ID},
-    [LY_STMT_INCLUDE] = {"include", "module", STMT_FLAG_ID},
-    [LY_STMT_INPUT] = {"input", NULL, 0},
-    [LY_STMT_KEY] = {"key", "value", 0},
-    [LY_STMT_LEAF] = {"leaf", "name", STMT_FLAG_ID},
-    [LY_STMT_LEAF_LIST] = {"leaf-list", "name", STMT_FLAG_ID},
-    [LY_STMT_LENGTH] = {"length", "value", 0},
-    [LY_STMT_LIST] = {"list", "name", STMT_FLAG_ID},
-    [LY_STMT_MANDATORY] = {"mandatory", "value", STMT_FLAG_ID},
-    [LY_STMT_MAX_ELEMENTS] = {"max-elements", "value", STMT_FLAG_ID},
-    [LY_STMT_MIN_ELEMENTS] = {"min-elements", "value", STMT_FLAG_ID},
-    [LY_STMT_MODIFIER] = {"modifier", "value", STMT_FLAG_ID},
-    [LY_STMT_MODULE] = {"module", "name", STMT_FLAG_ID},
-    [LY_STMT_MUST] = {"must", "condition", 0},
-    [LY_STMT_NAMESPACE] = {"namespace", "uri", 0},
-    [LY_STMT_NOTIFICATION] = {"notification", "name", STMT_FLAG_ID},
-    [LY_STMT_ORDERED_BY] = {"ordered-by", "value", STMT_FLAG_ID},
-    [LY_STMT_ORGANIZATION] = {"organization", "text", STMT_FLAG_YIN},
-    [LY_STMT_OUTPUT] = {"output", NULL, 0},
-    [LY_STMT_PATH] = {"path", "value", 0},
-    [LY_STMT_PATTERN] = {"pattern", "value", 0},
-    [LY_STMT_POSITION] = {"position", "value", STMT_FLAG_ID},
-    [LY_STMT_PREFIX] = {"prefix", "value", STMT_FLAG_ID},
-    [LY_STMT_PRESENCE] = {"presence", "value", 0},
-    [LY_STMT_RANGE] = {"range", "value", 0},
-    [LY_STMT_REFERENCE] = {"reference", "text", STMT_FLAG_YIN},
-    [LY_STMT_REFINE] = {"refine", "target-node", STMT_FLAG_ID},
-    [LY_STMT_REQUIRE_INSTANCE] = {"require-instance", "value", STMT_FLAG_ID},
-    [LY_STMT_REVISION] = {"revision", "date", STMT_FLAG_ID},
-    [LY_STMT_REVISION_DATE] = {"revision-date", "date", STMT_FLAG_ID},
-    [LY_STMT_RPC] = {"rpc", "name", STMT_FLAG_ID},
-    [LY_STMT_STATUS] = {"status", "value", STMT_FLAG_ID},
-    [LY_STMT_SUBMODULE] = {"submodule", "name", STMT_FLAG_ID},
-    [LY_STMT_SYNTAX_LEFT_BRACE] = {"{", NULL, 0},
-    [LY_STMT_SYNTAX_RIGHT_BRACE] = {"}", NULL, 0},
-    [LY_STMT_SYNTAX_SEMICOLON] = {";", NULL, 0},
-    [LY_STMT_TYPE] = {"type", "name", STMT_FLAG_ID},
-    [LY_STMT_TYPEDEF] = {"typedef", "name", STMT_FLAG_ID},
-    [LY_STMT_UNIQUE] = {"unique", "tag", 0},
-    [LY_STMT_UNITS] = {"units", "name", 0},
-    [LY_STMT_USES] = {"uses", "name", STMT_FLAG_ID},
-    [LY_STMT_VALUE] = {"value", "value", STMT_FLAG_ID},
-    [LY_STMT_WHEN] = {"when", "condition", 0},
-    [LY_STMT_YANG_VERSION] = {"yang-version", "value", STMT_FLAG_ID},
-    [LY_STMT_YIN_ELEMENT] = {"yin-element", "value", STMT_FLAG_ID},
-};
-
 LY_ERR
 lysp_check_prefix(struct lysp_ctx *ctx, struct lysp_import *imports, const char *module_prefix, const char **value)
 {
@@ -2356,3 +2275,343 @@
 
     return 0;
 }
+
+const char *
+lys_stmt_str(enum ly_stmt stmt)
+{
+    switch (stmt) {
+    case LY_STMT_NONE:
+        return NULL;
+    case LY_STMT_ACTION:
+        return "action";
+    case LY_STMT_ANYDATA:
+        return "anydata";
+    case LY_STMT_ANYXML:
+        return "anyxml";
+    case LY_STMT_ARGUMENT:
+        return "argument";
+    case LY_STMT_ARG_TEXT:
+        return "text";
+    case LY_STMT_ARG_VALUE:
+        return "value";
+    case LY_STMT_AUGMENT:
+        return "augment";
+    case LY_STMT_BASE:
+        return "base";
+    case LY_STMT_BELONGS_TO:
+        return "belongs-to";
+    case LY_STMT_BIT:
+        return "bit";
+    case LY_STMT_CASE:
+        return "case";
+    case LY_STMT_CHOICE:
+        return "choice";
+    case LY_STMT_CONFIG:
+        return "config";
+    case LY_STMT_CONTACT:
+        return "contact";
+    case LY_STMT_CONTAINER:
+        return "container";
+    case LY_STMT_DEFAULT:
+        return "default";
+    case LY_STMT_DESCRIPTION:
+        return "description";
+    case LY_STMT_DEVIATE:
+        return "deviate";
+    case LY_STMT_DEVIATION:
+        return "deviation";
+    case LY_STMT_ENUM:
+        return "enum";
+    case LY_STMT_ERROR_APP_TAG:
+        return "error-app-tag";
+    case LY_STMT_ERROR_MESSAGE:
+        return "error-message";
+    case LY_STMT_EXTENSION:
+        return "extension";
+    case LY_STMT_EXTENSION_INSTANCE:
+        return NULL;
+    case LY_STMT_FEATURE:
+        return "feature";
+    case LY_STMT_FRACTION_DIGITS:
+        return "fraction-digits";
+    case LY_STMT_GROUPING:
+        return "grouping";
+    case LY_STMT_IDENTITY:
+        return "identity";
+    case LY_STMT_IF_FEATURE:
+        return "if-feature";
+    case LY_STMT_IMPORT:
+        return "import";
+    case LY_STMT_INCLUDE:
+        return "include";
+    case LY_STMT_INPUT:
+        return "input";
+    case LY_STMT_KEY:
+        return "key";
+    case LY_STMT_LEAF:
+        return "leaf";
+    case LY_STMT_LEAF_LIST:
+        return "leaf-list";
+    case LY_STMT_LENGTH:
+        return "length";
+    case LY_STMT_LIST:
+        return "list";
+    case LY_STMT_MANDATORY:
+        return "mandatory";
+    case LY_STMT_MAX_ELEMENTS:
+        return "max-elements";
+    case LY_STMT_MIN_ELEMENTS:
+        return "min-elements";
+    case LY_STMT_MODIFIER:
+        return "modifier";
+    case LY_STMT_MODULE:
+        return "module";
+    case LY_STMT_MUST:
+        return "must";
+    case LY_STMT_NAMESPACE:
+        return "namespace";
+    case LY_STMT_NOTIFICATION:
+        return "notification";
+    case LY_STMT_ORDERED_BY:
+        return "ordered-by";
+    case LY_STMT_ORGANIZATION:
+        return "organization";
+    case LY_STMT_OUTPUT:
+        return "output";
+    case LY_STMT_PATH:
+        return "path";
+    case LY_STMT_PATTERN:
+        return "pattern";
+    case LY_STMT_POSITION:
+        return "position";
+    case LY_STMT_PREFIX:
+        return "prefix";
+    case LY_STMT_PRESENCE:
+        return "presence";
+    case LY_STMT_RANGE:
+        return "range";
+    case LY_STMT_REFERENCE:
+        return "reference";
+    case LY_STMT_REFINE:
+        return "refine";
+    case LY_STMT_REQUIRE_INSTANCE:
+        return "require-instance";
+    case LY_STMT_REVISION:
+        return "revision";
+    case LY_STMT_REVISION_DATE:
+        return "revision-date";
+    case LY_STMT_RPC:
+        return "rpc";
+    case LY_STMT_STATUS:
+        return "status";
+    case LY_STMT_SUBMODULE:
+        return "submodule";
+    case LY_STMT_SYNTAX_LEFT_BRACE:
+        return "{";
+    case LY_STMT_SYNTAX_RIGHT_BRACE:
+        return "}";
+    case LY_STMT_SYNTAX_SEMICOLON:
+        return ";";
+    case LY_STMT_TYPE:
+        return "type";
+    case LY_STMT_TYPEDEF:
+        return "typedef";
+    case LY_STMT_UNIQUE:
+        return "unique";
+    case LY_STMT_UNITS:
+        return "units";
+    case LY_STMT_USES:
+        return "uses";
+    case LY_STMT_VALUE:
+        return "value";
+    case LY_STMT_WHEN:
+        return "when";
+    case LY_STMT_YANG_VERSION:
+        return "yang-version";
+    case LY_STMT_YIN_ELEMENT:
+        return "yin-element";
+    }
+
+    return NULL;
+}
+
+const char *
+lys_stmt_arg(enum ly_stmt stmt)
+{
+    switch (stmt) {
+    case LY_STMT_NONE:
+    case LY_STMT_ARG_TEXT:
+    case LY_STMT_ARG_VALUE:
+    case LY_STMT_EXTENSION_INSTANCE:
+    case LY_STMT_INPUT:
+    case LY_STMT_OUTPUT:
+    case LY_STMT_SYNTAX_LEFT_BRACE:
+    case LY_STMT_SYNTAX_RIGHT_BRACE:
+    case LY_STMT_SYNTAX_SEMICOLON:
+        return NULL;
+    case LY_STMT_ACTION:
+    case LY_STMT_ANYDATA:
+    case LY_STMT_ANYXML:
+    case LY_STMT_ARGUMENT:
+    case LY_STMT_BASE:
+    case LY_STMT_BIT:
+    case LY_STMT_CASE:
+    case LY_STMT_CHOICE:
+    case LY_STMT_CONTAINER:
+    case LY_STMT_ENUM:
+    case LY_STMT_EXTENSION:
+    case LY_STMT_FEATURE:
+    case LY_STMT_GROUPING:
+    case LY_STMT_IDENTITY:
+    case LY_STMT_IF_FEATURE:
+    case LY_STMT_LEAF:
+    case LY_STMT_LEAF_LIST:
+    case LY_STMT_LIST:
+    case LY_STMT_MODULE:
+    case LY_STMT_NOTIFICATION:
+    case LY_STMT_RPC:
+    case LY_STMT_SUBMODULE:
+    case LY_STMT_TYPE:
+    case LY_STMT_TYPEDEF:
+    case LY_STMT_UNITS:
+    case LY_STMT_USES:
+        return "name";
+    case LY_STMT_AUGMENT:
+    case LY_STMT_DEVIATION:
+    case LY_STMT_REFINE:
+        return "target-node";
+    case LY_STMT_BELONGS_TO:
+    case LY_STMT_IMPORT:
+    case LY_STMT_INCLUDE:
+        return "module";
+    case LY_STMT_CONFIG:
+    case LY_STMT_DEFAULT:
+    case LY_STMT_DEVIATE:
+    case LY_STMT_ERROR_APP_TAG:
+    case LY_STMT_ERROR_MESSAGE:
+    case LY_STMT_FRACTION_DIGITS:
+    case LY_STMT_KEY:
+    case LY_STMT_LENGTH:
+    case LY_STMT_MANDATORY:
+    case LY_STMT_MAX_ELEMENTS:
+    case LY_STMT_MIN_ELEMENTS:
+    case LY_STMT_MODIFIER:
+    case LY_STMT_ORDERED_BY:
+    case LY_STMT_PATH:
+    case LY_STMT_PATTERN:
+    case LY_STMT_POSITION:
+    case LY_STMT_PREFIX:
+    case LY_STMT_PRESENCE:
+    case LY_STMT_RANGE:
+    case LY_STMT_REQUIRE_INSTANCE:
+    case LY_STMT_STATUS:
+    case LY_STMT_VALUE:
+    case LY_STMT_YANG_VERSION:
+    case LY_STMT_YIN_ELEMENT:
+        return "value";
+    case LY_STMT_CONTACT:
+    case LY_STMT_DESCRIPTION:
+    case LY_STMT_ORGANIZATION:
+    case LY_STMT_REFERENCE:
+        return "text";
+    case LY_STMT_MUST:
+    case LY_STMT_WHEN:
+        return "condition";
+    case LY_STMT_NAMESPACE:
+        return "uri";
+    case LY_STMT_REVISION:
+    case LY_STMT_REVISION_DATE:
+        return "date";
+    case LY_STMT_UNIQUE:
+        return "tag";
+    }
+
+    return NULL;
+}
+
+uint8_t
+lys_stmt_flags(enum ly_stmt stmt)
+{
+    switch (stmt) {
+    case LY_STMT_NONE:
+    case LY_STMT_ARG_TEXT:
+    case LY_STMT_ARG_VALUE:
+    case LY_STMT_DEFAULT:
+    case LY_STMT_ERROR_APP_TAG:
+    case LY_STMT_EXTENSION_INSTANCE:
+    case LY_STMT_IF_FEATURE:
+    case LY_STMT_INPUT:
+    case LY_STMT_KEY:
+    case LY_STMT_LENGTH:
+    case LY_STMT_MUST:
+    case LY_STMT_NAMESPACE:
+    case LY_STMT_OUTPUT:
+    case LY_STMT_PATH:
+    case LY_STMT_PATTERN:
+    case LY_STMT_PRESENCE:
+    case LY_STMT_RANGE:
+    case LY_STMT_SYNTAX_LEFT_BRACE:
+    case LY_STMT_SYNTAX_RIGHT_BRACE:
+    case LY_STMT_SYNTAX_SEMICOLON:
+    case LY_STMT_UNIQUE:
+    case LY_STMT_UNITS:
+    case LY_STMT_WHEN:
+        return 0;
+    case LY_STMT_ACTION:
+    case LY_STMT_ANYDATA:
+    case LY_STMT_ANYXML:
+    case LY_STMT_ARGUMENT:
+    case LY_STMT_AUGMENT:
+    case LY_STMT_BASE:
+    case LY_STMT_BELONGS_TO:
+    case LY_STMT_BIT:
+    case LY_STMT_CASE:
+    case LY_STMT_CHOICE:
+    case LY_STMT_CONFIG:
+    case LY_STMT_CONTAINER:
+    case LY_STMT_DEVIATE:
+    case LY_STMT_DEVIATION:
+    case LY_STMT_ENUM:
+    case LY_STMT_EXTENSION:
+    case LY_STMT_FEATURE:
+    case LY_STMT_FRACTION_DIGITS:
+    case LY_STMT_GROUPING:
+    case LY_STMT_IDENTITY:
+    case LY_STMT_IMPORT:
+    case LY_STMT_INCLUDE:
+    case LY_STMT_LEAF:
+    case LY_STMT_LEAF_LIST:
+    case LY_STMT_LIST:
+    case LY_STMT_MANDATORY:
+    case LY_STMT_MAX_ELEMENTS:
+    case LY_STMT_MIN_ELEMENTS:
+    case LY_STMT_MODIFIER:
+    case LY_STMT_MODULE:
+    case LY_STMT_NOTIFICATION:
+    case LY_STMT_ORDERED_BY:
+    case LY_STMT_POSITION:
+    case LY_STMT_PREFIX:
+    case LY_STMT_REFINE:
+    case LY_STMT_REQUIRE_INSTANCE:
+    case LY_STMT_REVISION:
+    case LY_STMT_REVISION_DATE:
+    case LY_STMT_RPC:
+    case LY_STMT_STATUS:
+    case LY_STMT_SUBMODULE:
+    case LY_STMT_TYPE:
+    case LY_STMT_TYPEDEF:
+    case LY_STMT_USES:
+    case LY_STMT_VALUE:
+    case LY_STMT_YANG_VERSION:
+    case LY_STMT_YIN_ELEMENT:
+        return LY_STMT_FLAG_ID;
+    case LY_STMT_CONTACT:
+    case LY_STMT_DESCRIPTION:
+    case LY_STMT_ERROR_MESSAGE:
+    case LY_STMT_ORGANIZATION:
+    case LY_STMT_REFERENCE:
+        return LY_STMT_FLAG_YIN;
+    }
+
+    return 0;
+}
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index 604697f..95dee0b 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -41,21 +41,6 @@
  */
 #define LY_MAX_BLOCK_DEPTH 500
 
-/**
- * @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 deviate modifications strings */
 extern const char * const ly_devmod_list[];
 #define ly_devmod2str(TYPE) ly_devmod_list[TYPE]
@@ -703,6 +688,30 @@
 ly_bool lys_has_dep_mods(const struct lys_module *mod);
 
 /**
+ * @brief Get YANG string keyword of a statement.
+ *
+ * @return YANG string keyword of the statement.
+ */
+const char *lys_stmt_str(enum ly_stmt stmt);
+
+/**
+ * @brief Get YIN argument (attribute) name of a statement.
+ *
+ * @return YIN argument name, if any.
+ */
+const char *lys_stmt_arg(enum ly_stmt stmt);
+
+#define LY_STMT_FLAG_YIN 0x1 /**< has YIN element */
+#define LY_STMT_FLAG_ID 0x2  /**< the value is identifier -> no quotes */
+
+/**
+ * @brief Get statement printer flags.
+ *
+ * @return Additional statement information as LY_STMT_FLAG_* flags.
+ */
+uint8_t lys_stmt_flags(enum ly_stmt stmt);
+
+/**
  * @brief Learn whether the module qualifies for a single dep set with only this module or not.
  *
  * @param[in] mod Module to examine.