tree schema CHANGE support extension instances in simple text statements
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 80313f4..3aa4b5d 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -84,11 +84,63 @@
};
/**
+ * @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_DIGITS, /**< 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;
+
+/**
* @brief YANG extension instance
*/
struct lysp_ext_instance {
const char *name; /**< extension identifier, including possible prefix */
const char *argument; /**< optional value of the extension's argument */
+ LYEXT_SUBSTMT insubstmt; /**< value identifying placement of the extension instance */
+ uint32_t insubstmt_index; /**< in case the instance is in a substatement, this identifies
+ the index of that substatement */
struct lysp_stmt *children; /**< list of the extension's substatements (linked list) */
};