summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e58643)
raw | patch | inline | side by side (parent: 5e58643)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 25 Oct 2012 09:32:38 +0000 (11:32 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 25 Oct 2012 09:32:38 +0000 (11:32 +0200) |
This allows to use empty blocks (which is useful during development and
testing) and empty files (which may happen when including config directories,
cf. Debian #592881).
In order not to generate a shift/reduce error, rather than allowing a
'statement_list' to be empty, this has been implemented by explicitly allowing
empty blocks and an empty 'entire_file'.
testing) and empty files (which may happen when including config directories,
cf. Debian #592881).
In order not to generate a shift/reduce error, rather than allowing a
'statement_list' to be empty, this has been implemented by explicitly allowing
empty blocks and an empty 'entire_file'.
src/liboconfig/parser.y | patch | blob | history |
index 5b7aa94a9e4deec315c5175f8503a4900536e3c1..19f58b2b75c4f19b9b196f5d15b85f8f78dd21ac 100644 (file)
--- a/src/liboconfig/parser.y
+++ b/src/liboconfig/parser.y
$$.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:
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;
+ }
;
%%