* Added Yang "extension" statement. This includes parsing unknown

statements and identifying them as extensions or not. However,
  semantics for specific extensions must still be added.
* Renamed ytype_id and ytype_prefix to yarg_id and yarg_prefix, respectively

* Added cli_show_version()
This commit is contained in:
Olof hagsand 2018-02-25 20:01:53 +01:00
parent 2acacbf087
commit 35b142cf4d
14 changed files with 264 additions and 116 deletions

View file

@ -46,7 +46,6 @@
%token MY_EOF
%token DQ /* Double quote: " */
%token K_UNKNOWN /* template for error */
%token <string> CHAR
%type <string> ustring
@ -239,12 +238,18 @@ ystack_push(struct clicon_yang_yacc_arg *yy,
/*! Add a yang statement to existing top-of-stack.
*
* Note: consumes 'argument' which assumes it is malloced and not freed by caller
* @param[in] yy Yang yacc argument
* @param[in] keyword Yang keyword
* @param[in] argument Yang argument
* @param[in] extra Yang extra for cornercases (unknown/extension)
* @note consumes 'argument' and 'extra' which assumes it is malloced and not freed by caller
*/
static yang_stmt *
ysp_add(struct clicon_yang_yacc_arg *yy,
enum rfc_6020 keyword,
char *argument)
char *argument,
char *extra)
{
struct ys_stack *ystack = yy->yy_stack;
yang_stmt *ys = NULL;
@ -262,7 +267,7 @@ ysp_add(struct clicon_yang_yacc_arg *yy,
ys->ys_argument = argument;
if (yn_insert(yn, ys) < 0) /* Insert into hierarchy */
goto err;
if (ys_parse_sub(ys) < 0) /* Check statement-specific syntax */
if (ys_parse_sub(ys, extra) < 0) /* Check statement-specific syntax */
goto err2; /* dont free since part of tree */
// done:
return ys;
@ -276,12 +281,12 @@ ysp_add(struct clicon_yang_yacc_arg *yy,
/*! combination of ysp_add and ysp_push for sub-modules */
static yang_stmt *
ysp_add_push(struct clicon_yang_yacc_arg *yy,
int keyword,
enum rfc_6020 keyword,
char *argument)
{
yang_stmt *ys;
if ((ys = ysp_add(yy, keyword, argument)) == NULL)
if ((ys = ysp_add(yy, keyword, argument, NULL)) == NULL)
return NULL;
if (ystack_push(yy, (yang_node*)ys) == NULL)
return NULL;
@ -330,12 +335,22 @@ file : module_stmt MY_EOF
{ clicon_debug(2,"file->submodule-stmt"); YYACCEPT; }
;
unknown_stmt : K_UNKNOWN { clixon_yang_parseerror(_yy, "unknown statement");clicon_debug(2,"unknown-stmt"); _YYERROR("0"); }
;
/* For extensions */
unknown_stmt : ustring ':' ustring ';'
{ char *id; if ((id=prefix_id_join($1, $3)) == NULL) _YYERROR("0");
if (ysp_add(_yy, Y_UNKNOWN, id, NULL) == NULL) _YYERROR("0");
clicon_debug(2,"unknown-stmt -> ustring : ustring");
}
| ustring ':' ustring ' ' string ';'
{ char *id; if ((id=prefix_id_join($1, $3)) == NULL) _YYERROR("0");
if (ysp_add(_yy, Y_UNKNOWN, id, $5) == NULL) _YYERROR("0");
clicon_debug(2,"unknown-stmt -> ustring : ustring string");
}
;
/* module */
module_stmt : K_MODULE id_arg_str
{ if ((_YY->yy_module = ysp_add_push(_yy, Y_MODULE, $2)) == NULL) _YYERROR("1");
{ if ((_YY->yy_module = ysp_add_push(_yy, Y_MODULE, $2)) == NULL) _YYERROR("1");
}
'{' module_substmts '}'
{ if (ystack_pop(_yy) < 0) _YYERROR("2");
@ -359,7 +374,7 @@ module_substmt : module_header_stmts { clicon_debug(2,"module-substmt -> module-
/* submodule */
submodule_stmt : K_SUBMODULE id_arg_str '{' submodule_substmts '}'
{ if ((_YY->yy_module = ysp_add_push(_yy, Y_SUBMODULE, $2)) == NULL) _YYERROR("3");
{ if ((_YY->yy_module = ysp_add_push(_yy, Y_SUBMODULE, $2)) == NULL) _YYERROR("3");
clicon_debug(2,"submodule -> id-arg-str { submodule-stmts }");
}
;
@ -422,7 +437,7 @@ revision_stmts : revision_stmts revision_stmt
;
revision_stmt : K_REVISION string ';' /* XXX date-arg-str */
{ if (ysp_add(_yy, Y_REVISION, $2) == NULL) _YYERROR("4");
{ if (ysp_add(_yy, Y_REVISION, $2, NULL) == NULL) _YYERROR("4");
clicon_debug(2,"revision-stmt -> date-arg-str ;"); }
| K_REVISION string
{ if (ysp_add_push(_yy, Y_REVISION, $2) == NULL) _YYERROR("5"); }
@ -482,7 +497,7 @@ data_def_stmt : container_stmt { clicon_debug(2,"data-def-stmt -> containe
/* container */
container_stmt : K_CONTAINER id_arg_str ';'
{ if (ysp_add(_yy, Y_CONTAINER, $2) == NULL) _YYERROR("7");
{ if (ysp_add(_yy, Y_CONTAINER, $2, NULL) == NULL) _YYERROR("7");
clicon_debug(2,"container-stmt -> CONTAINER id-arg-str ;");}
| K_CONTAINER id_arg_str
{ if (ysp_add_push(_yy, Y_CONTAINER, $2) == NULL) _YYERROR("8"); }
@ -512,7 +527,7 @@ container_substmt : when_stmt { clicon_debug(2,"container-substmt -> when-
/* leaf */
leaf_stmt : K_LEAF id_arg_str ';'
{ if (ysp_add(_yy, Y_LEAF, $2) == NULL) _YYERROR("10");
{ if (ysp_add(_yy, Y_LEAF, $2, NULL) == NULL) _YYERROR("10");
clicon_debug(2,"leaf-stmt -> LEAF id-arg-str ;");}
| K_LEAF id_arg_str
{ if (ysp_add_push(_yy, Y_LEAF, $2) == NULL) _YYERROR("11"); }
@ -542,7 +557,7 @@ leaf_substmt : when_stmt { clicon_debug(2,"leaf-substmt -> when-stmt
/* leaf-list */
leaf_list_stmt : K_LEAF_LIST id_arg_str ';'
{ if (ysp_add(_yy, Y_LEAF_LIST, $2) == NULL) _YYERROR("13");
{ if (ysp_add(_yy, Y_LEAF_LIST, $2, NULL) == NULL) _YYERROR("13");
clicon_debug(2,"leaf-list-stmt -> LEAF id-arg-str ;");}
| K_LEAF_LIST id_arg_str
{ if (ysp_add_push(_yy, Y_LEAF_LIST, $2) == NULL) _YYERROR("14"); }
@ -573,7 +588,7 @@ leaf_list_substmt : when_stmt { clicon_debug(2,"leaf-list-substmt -> when
/* list */
list_stmt : K_LIST id_arg_str ';'
{ if (ysp_add(_yy, Y_LIST, $2) == NULL) _YYERROR("16");
{ if (ysp_add(_yy, Y_LIST, $2, NULL) == NULL) _YYERROR("16");
clicon_debug(2,"list-stmt -> LIST id-arg-str ;"); }
| K_LIST id_arg_str
{ if (ysp_add_push(_yy, Y_LIST, $2) == NULL) _YYERROR("17"); }
@ -609,7 +624,7 @@ list_substmt : when_stmt { clicon_debug(2,"list-substmt -> when-stmt
/* choice */
choice_stmt : K_CHOICE id_arg_str ';'
{ if (ysp_add(_yy, Y_CHOICE, $2) == NULL) _YYERROR("19");
{ if (ysp_add(_yy, Y_CHOICE, $2, NULL) == NULL) _YYERROR("19");
clicon_debug(2,"choice-stmt -> CHOICE id-arg-str ;"); }
| K_CHOICE id_arg_str
{ if (ysp_add_push(_yy, Y_CHOICE, $2) == NULL) _YYERROR("20"); }
@ -648,7 +663,7 @@ short_case_stmt : container_stmt { clicon_debug(2,"short-case-substmt -> conta
/* case */
case_stmt : K_CASE id_arg_str ';'
{ if (ysp_add(_yy, Y_CASE, $2) == NULL) _YYERROR("22");
{ if (ysp_add(_yy, Y_CASE, $2, NULL) == NULL) _YYERROR("22");
clicon_debug(2,"case-stmt -> CASE id-arg-str ;"); }
| K_CASE id_arg_str
{ if (ysp_add_push(_yy, Y_CASE, $2) == NULL) _YYERROR("23"); }
@ -676,7 +691,7 @@ case_substmt : when_stmt { clicon_debug(2,"case-substmt -> when-stmt
/* anyxml */
anyxml_stmt : K_ANYXML id_arg_str ';'
{ if (ysp_add(_yy, Y_ANYXML, $2) == NULL) _YYERROR("25");
{ if (ysp_add(_yy, Y_ANYXML, $2, NULL) == NULL) _YYERROR("25");
clicon_debug(2,"anyxml-stmt -> ANYXML id-arg-str ;"); }
| K_ANYXML id_arg_str
{ if (ysp_add_push(_yy, Y_ANYXML, $2) == NULL) _YYERROR("26"); }
@ -704,7 +719,7 @@ anyxml_substmt : when_stmt { clicon_debug(2,"anyxml-substmt -> when-st
/* uses */
uses_stmt : K_USES identifier_ref_arg_str ';'
{ if (ysp_add(_yy, Y_USES, $2) == NULL) _YYERROR("28");
{ if (ysp_add(_yy, Y_USES, $2, NULL) == NULL) _YYERROR("28");
clicon_debug(2,"uses-stmt -> USES id-arg-str ;"); }
| K_USES identifier_ref_arg_str
{ if (ysp_add_push(_yy, Y_USES, $2) == NULL) _YYERROR("29"); }
@ -732,7 +747,7 @@ uses_substmt : when_stmt { clicon_debug(2,"uses-substmt -> when-stmt
/* refine XXX need further refining */
refine_stmt : K_REFINE id_arg_str ';'
{ if (ysp_add(_yy, Y_REFINE, $2) == NULL) _YYERROR("31");
{ if (ysp_add(_yy, Y_REFINE, $2, NULL) == NULL) _YYERROR("31");
clicon_debug(2,"refine-stmt -> REFINE id-arg-str ;"); }
| K_REFINE id_arg_str
{ if (ysp_add_push(_yy, Y_REFINE, $2) == NULL) _YYERROR("32"); }
@ -782,7 +797,7 @@ augment_substmt : when_stmt { clicon_debug(2,"augment-substmt -> when-s
/* when */
when_stmt : K_WHEN string ';'
{ if (ysp_add(_yy, Y_WHEN, $2) == NULL) _YYERROR("36");
{ if (ysp_add(_yy, Y_WHEN, $2, NULL) == NULL) _YYERROR("36");
clicon_debug(2,"when-stmt -> WHEN string ;"); }
| K_WHEN string
{ if (ysp_add_push(_yy, Y_WHEN, $2) == NULL) _YYERROR("37"); }
@ -804,7 +819,7 @@ when_substmt : description_stmt { clicon_debug(2,"when-substmt -> description-s
/* rpc */
rpc_stmt : K_RPC id_arg_str ';'
{ if (ysp_add(_yy, Y_RPC, $2) == NULL) _YYERROR("39");
{ if (ysp_add(_yy, Y_RPC, $2, NULL) == NULL) _YYERROR("39");
clicon_debug(2,"rpc-stmt -> RPC id-arg-str ;"); }
| K_RPC id_arg_str
{ if (ysp_add_push(_yy, Y_RPC, $2) == NULL) _YYERROR("40"); }
@ -885,7 +900,7 @@ typedef_substmt : type_stmt { clicon_debug(2,"typedef-substmt -> type-s
/* Type */
type_stmt : K_TYPE identifier_ref_arg_str ';'
{ if (ysp_add(_yy, Y_TYPE, $2) == NULL) _YYERROR("48");
{ if (ysp_add(_yy, Y_TYPE, $2, NULL) == NULL) _YYERROR("48");
clicon_debug(2,"type-stmt -> TYPE identifier-ref-arg-str ;");}
| K_TYPE identifier_ref_arg_str
{ if (ysp_add_push(_yy, Y_TYPE, $2) == NULL) _YYERROR("49");
@ -953,7 +968,7 @@ grouping_substmt : status_stmt { clicon_debug(2,"grouping-substmt -> st
/* length-stmt */
length_stmt : K_LENGTH string ';' /* XXX length-arg-str */
{ if (ysp_add(_yy, Y_LENGTH, $2) == NULL) _YYERROR("53");
{ if (ysp_add(_yy, Y_LENGTH, $2, NULL) == NULL) _YYERROR("53");
clicon_debug(2,"length-stmt -> LENGTH string ;"); }
| K_LENGTH string
@ -978,7 +993,7 @@ length_substmt : error_message_stmt { clicon_debug(2,"length-substmt -> error-m
/* Pattern */
pattern_stmt : K_PATTERN string ';'
{ if (ysp_add(_yy, Y_PATTERN, $2) == NULL) _YYERROR("56");
{ if (ysp_add(_yy, Y_PATTERN, $2, NULL) == NULL) _YYERROR("56");
clicon_debug(2,"pattern-stmt -> PATTERN string ;"); }
| K_PATTERN string
@ -1002,7 +1017,7 @@ pattern_substmt : reference_stmt { clicon_debug(2,"pattern-substmt -> refere
/* Extension */
extension_stmt: K_EXTENSION id_arg_str ';'
{ if (ysp_add(_yy, Y_EXTENSION, $2) == NULL) _YYERROR("59");
{ if (ysp_add(_yy, Y_EXTENSION, $2, NULL) == NULL) _YYERROR("59");
clicon_debug(2,"extenstion-stmt -> EXTENSION id-arg-str ;"); }
| K_EXTENSION id_arg_str
{ if (ysp_add_push(_yy, Y_EXTENSION, $2) == NULL) _YYERROR("60"); }
@ -1033,7 +1048,7 @@ argument_stmt : K_ARGUMENT id_arg_str ';'
/* Feature */
feature_stmt : K_FEATURE id_arg_str ';'
{ if (ysp_add(_yy, Y_FEATURE, $2) == NULL) _YYERROR("62");
{ if (ysp_add(_yy, Y_FEATURE, $2, NULL) == NULL) _YYERROR("62");
clicon_debug(2,"feature-stmt -> FEATURE id-arg-str ;"); }
| K_FEATURE id_arg_str
{ if (ysp_add_push(_yy, Y_FEATURE, $2) == NULL) _YYERROR("63"); }
@ -1059,7 +1074,7 @@ feature_substmt : if_feature_stmt { clicon_debug(2,"feature-substmt -> if-fea
/* Identity */
identity_stmt : K_IDENTITY string ';' /* XXX identifier-arg-str */
{ if (ysp_add(_yy, Y_IDENTITY, $2) == NULL) _YYERROR("65");
{ if (ysp_add(_yy, Y_IDENTITY, $2, NULL) == NULL) _YYERROR("65");
clicon_debug(2,"identity-stmt -> IDENTITY string ;"); }
| K_IDENTITY string
@ -1085,7 +1100,7 @@ identity_substmt : base_stmt { clicon_debug(2,"identity-substmt -> base-
/* range-stmt */
range_stmt : K_RANGE string ';' /* XXX range-arg-str */
{ if (ysp_add(_yy, Y_RANGE, $2) == NULL) _YYERROR("68");
{ if (ysp_add(_yy, Y_RANGE, $2, NULL) == NULL) _YYERROR("68");
clicon_debug(2,"range-stmt -> RANGE string ;"); }
| K_RANGE string
@ -1110,7 +1125,7 @@ range_substmt : error_message_stmt { clicon_debug(2,"range-substmt -> error-me
/* enum-stmt */
enum_stmt : K_ENUM string ';'
{ if (ysp_add(_yy, Y_ENUM, $2) == NULL) _YYERROR("71");
{ if (ysp_add(_yy, Y_ENUM, $2, NULL) == NULL) _YYERROR("71");
clicon_debug(2,"enum-stmt -> ENUM string ;"); }
| K_ENUM string
{ if (ysp_add_push(_yy, Y_ENUM, $2) == NULL) _YYERROR("72"); }
@ -1135,7 +1150,7 @@ enum_substmt : value_stmt { clicon_debug(2,"enum-substmt -> value-stm
/* bit-stmt */
bit_stmt : K_BIT string ';'
{ if (ysp_add(_yy, Y_BIT, $2) == NULL) _YYERROR("74");
{ if (ysp_add(_yy, Y_BIT, $2, NULL) == NULL) _YYERROR("74");
clicon_debug(2,"bit-stmt -> BIT string ;"); }
| K_BIT string
{ if (ysp_add_push(_yy, Y_BIT, $2) == NULL) _YYERROR("75"); }
@ -1159,7 +1174,7 @@ bit_substmt : position_stmt { clicon_debug(2,"bit-substmt -> positition
/* mus-stmt */
must_stmt : K_MUST string ';'
{ if (ysp_add(_yy, Y_MUST, $2) == NULL) _YYERROR("77");
{ if (ysp_add(_yy, Y_MUST, $2, NULL) == NULL) _YYERROR("77");
clicon_debug(2,"must-stmt -> MUST string ;"); }
| K_MUST string
@ -1183,7 +1198,7 @@ must_substmt : error_message_stmt { clicon_debug(2,"must-substmt -> error-mes
/* error-message-stmt */
error_message_stmt : K_ERROR_MESSAGE string ';'
{ if (ysp_add(_yy, Y_ERROR_MESSAGE, $2) == NULL) _YYERROR("80"); }
{ if (ysp_add(_yy, Y_ERROR_MESSAGE, $2, NULL) == NULL) _YYERROR("80"); }
/* import */
import_stmt : K_IMPORT id_arg_str
@ -1206,144 +1221,144 @@ import_substmt : prefix_stmt { clicon_debug(2,"import-stmt -> prefix-stmt"); }
/* Simple statements */
yang_version_stmt : K_YANG_VERSION string ';' /* XXX yang-version-arg-str */
{ if (ysp_add(_yy, Y_YANG_VERSION, $2) == NULL) _YYERROR("83");
{ if (ysp_add(_yy, Y_YANG_VERSION, $2, NULL) == NULL) _YYERROR("83");
clicon_debug(2,"yang-version-stmt -> YANG-VERSION string"); }
;
fraction_digits_stmt : K_FRACTION_DIGITS string ';' /* XXX: fraction-digits-arg-str */
{ if (ysp_add(_yy, Y_FRACTION_DIGITS, $2) == NULL) _YYERROR("84");
{ if (ysp_add(_yy, Y_FRACTION_DIGITS, $2, NULL) == NULL) _YYERROR("84");
clicon_debug(2,"fraction-digits-stmt -> FRACTION-DIGITS string"); }
;
if_feature_stmt : K_IF_FEATURE identifier_ref_arg_str ';'
{ if (ysp_add(_yy, Y_IF_FEATURE, $2) == NULL) _YYERROR("85");
{ if (ysp_add(_yy, Y_IF_FEATURE, $2, NULL) == NULL) _YYERROR("85");
clicon_debug(2,"if-feature-stmt -> IF-FEATURE identifier-ref-arg-str"); }
;
value_stmt : K_VALUE integer_value ';'
{ if (ysp_add(_yy, Y_VALUE, $2) == NULL) _YYERROR("86");
{ if (ysp_add(_yy, Y_VALUE, $2, NULL) == NULL) _YYERROR("86");
clicon_debug(2,"value-stmt -> VALUE integer-value"); }
;
position_stmt : K_POSITION integer_value ';'
{ if (ysp_add(_yy, Y_POSITION, $2) == NULL) _YYERROR("87");
{ if (ysp_add(_yy, Y_POSITION, $2, NULL) == NULL) _YYERROR("87");
clicon_debug(2,"position-stmt -> POSITION integer-value"); }
;
status_stmt : K_STATUS string ';' /* XXX: status-arg-str */
{ if (ysp_add(_yy, Y_STATUS, $2) == NULL) _YYERROR("88");
{ if (ysp_add(_yy, Y_STATUS, $2, NULL) == NULL) _YYERROR("88");
clicon_debug(2,"status-stmt -> STATUS string"); }
;
config_stmt : K_CONFIG config_arg_str ';'
{ if (ysp_add(_yy, Y_CONFIG, $2) == NULL) _YYERROR("89");
{ if (ysp_add(_yy, Y_CONFIG, $2, NULL) == NULL) _YYERROR("89");
clicon_debug(2,"config-stmt -> CONFIG config-arg-str"); }
;
base_stmt : K_BASE identifier_ref_arg_str ';'
{ if (ysp_add(_yy, Y_BASE, $2)== NULL) _YYERROR("90");
{ if (ysp_add(_yy, Y_BASE, $2, NULL)== NULL) _YYERROR("90");
clicon_debug(2,"base-stmt -> BASE identifier-ref-arg-str"); }
;
path_stmt : K_PATH string ';' /* XXX: path-arg-str */
{ if (ysp_add(_yy, Y_PATH, $2)== NULL) _YYERROR("91");
{ if (ysp_add(_yy, Y_PATH, $2, NULL)== NULL) _YYERROR("91");
clicon_debug(2,"path-stmt -> PATH string"); }
;
require_instance_stmt : K_REQUIRE_INSTANCE string ';' /* XXX: require-instance-arg-str */
{ if (ysp_add(_yy, Y_REQUIRE_INSTANCE, $2)== NULL) _YYERROR("92");
{ if (ysp_add(_yy, Y_REQUIRE_INSTANCE, $2, NULL)== NULL) _YYERROR("92");
clicon_debug(2,"require-instance-stmt -> REQUIRE-INSTANCE string"); }
;
units_stmt : K_UNITS string ';'
{ if (ysp_add(_yy, Y_UNITS, $2)== NULL) _YYERROR("93");
{ if (ysp_add(_yy, Y_UNITS, $2, NULL)== NULL) _YYERROR("93");
clicon_debug(2,"units-stmt -> UNITS string"); }
;
default_stmt : K_DEFAULT string ';'
{ if (ysp_add(_yy, Y_DEFAULT, $2)== NULL) _YYERROR("94");
{ if (ysp_add(_yy, Y_DEFAULT, $2, NULL)== NULL) _YYERROR("94");
clicon_debug(2,"default-stmt -> DEFAULT string"); }
;
contact_stmt : K_CONTACT string ';'
{ if (ysp_add(_yy, Y_CONTACT, $2)== NULL) _YYERROR("95");
{ if (ysp_add(_yy, Y_CONTACT, $2, NULL)== NULL) _YYERROR("95");
clicon_debug(2,"contact-stmt -> CONTACT string"); }
;
revision_date_stmt : K_REVISION_DATE string ';' /* XXX date-arg-str */
{ if (ysp_add(_yy, Y_REVISION_DATE, $2) == NULL) _YYERROR("96");
{ if (ysp_add(_yy, Y_REVISION_DATE, $2, NULL) == NULL) _YYERROR("96");
clicon_debug(2,"revision-date-stmt -> date;"); }
;
include_stmt : K_INCLUDE id_arg_str ';'
{ if (ysp_add(_yy, Y_INCLUDE, $2)== NULL) _YYERROR("97");
{ if (ysp_add(_yy, Y_INCLUDE, $2, NULL)== NULL) _YYERROR("97");
clicon_debug(2,"include-stmt -> id-arg-str"); }
| K_INCLUDE id_arg_str '{' revision_date_stmt '}'
{ if (ysp_add(_yy, Y_INCLUDE, $2)== NULL) _YYERROR("98");
{ if (ysp_add(_yy, Y_INCLUDE, $2, NULL)== NULL) _YYERROR("98");
clicon_debug(2,"include-stmt -> id-arg-str { revision-date-stmt }"); }
;
namespace_stmt : K_NAMESPACE string ';' /* XXX uri-str */
{ if (ysp_add(_yy, Y_NAMESPACE, $2)== NULL) _YYERROR("99");
{ if (ysp_add(_yy, Y_NAMESPACE, $2, NULL)== NULL) _YYERROR("99");
clicon_debug(2,"namespace-stmt -> NAMESPACE string"); }
;
prefix_stmt : K_PREFIX string ';' /* XXX prefix-arg-str */
{ if (ysp_add(_yy, Y_PREFIX, $2)== NULL) _YYERROR("100");
{ if (ysp_add(_yy, Y_PREFIX, $2, NULL)== NULL) _YYERROR("100");
clicon_debug(2,"prefix-stmt -> PREFIX string ;");}
;
description_stmt: K_DESCRIPTION string ';'
{ if (ysp_add(_yy, Y_DESCRIPTION, $2)== NULL) _YYERROR("101");
{ if (ysp_add(_yy, Y_DESCRIPTION, $2, NULL)== NULL) _YYERROR("101");
clicon_debug(2,"description-stmt -> DESCRIPTION string ;");}
;
organization_stmt: K_ORGANIZATION string ';'
{ if (ysp_add(_yy, Y_ORGANIZATION, $2)== NULL) _YYERROR("102");
{ if (ysp_add(_yy, Y_ORGANIZATION, $2, NULL)== NULL) _YYERROR("102");
clicon_debug(2,"organization-stmt -> ORGANIZATION string ;");}
;
min_elements_stmt: K_MIN_ELEMENTS integer_value ';'
{ if (ysp_add(_yy, Y_MIN_ELEMENTS, $2)== NULL) _YYERROR("103");
{ if (ysp_add(_yy, Y_MIN_ELEMENTS, $2, NULL)== NULL) _YYERROR("103");
clicon_debug(2,"min-elements-stmt -> MIN-ELEMENTS integer ;");}
;
max_elements_stmt: K_MAX_ELEMENTS integer_value ';'
{ if (ysp_add(_yy, Y_MAX_ELEMENTS, $2)== NULL) _YYERROR("104");
{ if (ysp_add(_yy, Y_MAX_ELEMENTS, $2, NULL)== NULL) _YYERROR("104");
clicon_debug(2,"max-elements-stmt -> MIN-ELEMENTS integer ;");}
;
reference_stmt: K_REFERENCE string ';'
{ if (ysp_add(_yy, Y_REFERENCE, $2)== NULL) _YYERROR("105");
{ if (ysp_add(_yy, Y_REFERENCE, $2, NULL)== NULL) _YYERROR("105");
clicon_debug(2,"reference-stmt -> REFERENCE string ;");}
;
mandatory_stmt: K_MANDATORY string ';'
{ yang_stmt *ys;
if ((ys = ysp_add(_yy, Y_MANDATORY, $2))== NULL) _YYERROR("106");
if ((ys = ysp_add(_yy, Y_MANDATORY, $2, NULL))== NULL) _YYERROR("106");
clicon_debug(2,"mandatory-stmt -> MANDATORY mandatory-arg-str ;");}
;
presence_stmt: K_PRESENCE string ';'
{ yang_stmt *ys;
if ((ys = ysp_add(_yy, Y_PRESENCE, $2))== NULL) _YYERROR("107");
if ((ys = ysp_add(_yy, Y_PRESENCE, $2, NULL))== NULL) _YYERROR("107");
clicon_debug(2,"presence-stmt -> PRESENCE string ;");}
;
ordered_by_stmt: K_ORDERED_BY string ';'
{ yang_stmt *ys;
if ((ys = ysp_add(_yy, Y_ORDERED_BY, $2))== NULL) _YYERROR("108");
if ((ys = ysp_add(_yy, Y_ORDERED_BY, $2, NULL))== NULL) _YYERROR("108");
clicon_debug(2,"ordered-by-stmt -> ORDERED-BY ordered-by-arg ;");}
;
key_stmt : K_KEY id_arg_str ';' /* XXX key_arg_str */
{ if (ysp_add(_yy, Y_KEY, $2)== NULL) _YYERROR("109");
{ if (ysp_add(_yy, Y_KEY, $2, NULL)== NULL) _YYERROR("109");
clicon_debug(2,"key-stmt -> KEY id-arg-str ;");}
;
unique_stmt : K_UNIQUE id_arg_str ';' /* XXX key_arg_str */
{ if (ysp_add(_yy, Y_UNIQUE, $2)== NULL) _YYERROR("110");
{ if (ysp_add(_yy, Y_UNIQUE, $2, NULL)== NULL) _YYERROR("110");
clicon_debug(2,"key-stmt -> KEY id-arg-str ;");}
;