From: Florian Forster Date: Sat, 10 Nov 2012 08:05:54 +0000 (+0100) Subject: Merge remote-tracking branch 'github-tokkee/sh/empty-config' X-Git-Tag: collectd-5.2.0~30 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=1126617bebe569dffe6b7a5d3f0c400134b41d65;hp=bd84c0f19f7010e33cedfd0549250135c73f6c00;p=collectd.git Merge remote-tracking branch 'github-tokkee/sh/empty-config' --- 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; + } ; %%