X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fliboconfig%2Fparser.y;h=19f58b2b75c4f19b9b196f5d15b85f8f78dd21ac;hb=96e0f2341bace029acefe0a88bab96ae326c0ff5;hp=5b7aa94a9e4deec315c5175f8503a4900536e3c1;hpb=3bd6fcdfd20002eee1f1803460728449c0c98f86;p=collectd.git diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index 5b7aa94a..19f58b2b 100644 --- a/src/liboconfig/parser.y +++ b/src/liboconfig/parser.y @@ -148,6 +148,19 @@ block: $$.children = $2.statement; $$.children_num = $2.statement_num; } + | block_begin block_end + { + if (strcmp ($1.key, $2) != 0) + { + printf ("block_begin = %s; block_end = %s;\n", $1.key, $2); + yyerror ("Block not closed..\n"); + exit (1); + } + free ($2); $2 = NULL; + $$ = $1; + $$.children = NULL; + $$.children_num = 0; + } ; statement: @@ -191,6 +204,13 @@ entire_file: ci_root->children = $1.statement; ci_root->children_num = $1.statement_num; } + | /* epsilon */ + { + ci_root = malloc (sizeof (oconfig_item_t)); + memset (ci_root, '\0', sizeof (oconfig_item_t)); + ci_root->children = NULL; + ci_root->children_num = 0; + } ; %%