YANG keywords "action" and "belongs-to" implemented by syntactically by parser (but not proper semantics).

This commit is contained in:
Olof hagsand 2018-11-04 18:36:55 +01:00
parent 270bf78e1f
commit 366cf041bd
8 changed files with 41 additions and 9 deletions

View file

@ -1738,7 +1738,7 @@ yang_parse_str(char *str,
/*! Parse yang spec from an open file descriptor
* @param[in] fd File descriptor containing the YANG file as ASCII characters
* @param[in] name For debug, eg filename
* @param[in] ysp Yang specification. Should ave been created by caller using yspec_new
* @param[in] ysp Yang specification. Should have been created by caller using yspec_new
* @retval ymod Top-level yang (sub)module
* @retval NULL Error
*/

View file

@ -418,6 +418,7 @@ submodule_header_stmts : submodule_header_stmts submodule_header_stmt
submodule_header_stmt : yang_version_stmt
{ clicon_debug(2,"submodule-header-stmt -> yang-version-stmt"); }
| belongs_to_stmt { clicon_debug(2,"submodule-header-stmt -> belongs-to-stmt"); }
;
/* linkage */
@ -1359,6 +1360,15 @@ prefix_stmt : K_PREFIX string ';' /* XXX prefix-arg-str */
clicon_debug(2,"prefix-stmt -> PREFIX string ;");}
;
belongs_to_stmt : K_BELONGS_TO id_arg_str ';'
{ if (ysp_add(_yy, Y_BELONGS_TO, $2, NULL)== NULL) _YYERROR("100");
clicon_debug(2,"belongs-to-stmt -> BELONGS-TO id-arg-str ;");}
| K_BELONGS_TO id_arg_str '{' prefix_stmt '}'
{ if (ysp_add(_yy, Y_BELONGS_TO, $2, NULL)== NULL) _YYERROR("98");
clicon_debug(2,"belongs-to-stmt -> BELONGS-TO id-arg-str { prefix-stmt } ");}
;
description_stmt: K_DESCRIPTION string ';'
{ if (ysp_add(_yy, Y_DESCRIPTION, $2, NULL)== NULL) _YYERROR("101");
clicon_debug(2,"description-stmt -> DESCRIPTION string ;");}