index 49cd139dbd76bd1e4505b3184194d6066a1be11b..19f58b2b75c4f19b9b196f5d15b85f8f78dd21ac 100644 (file)
--- a/src/liboconfig/parser.y
+++ b/src/liboconfig/parser.y
}
%token <number> NUMBER
-%token <boolean> TRUE FALSE
+%token <boolean> BTRUE BFALSE
%token <string> QUOTED_STRING UNQUOTED_STRING
%token SLASH OPENBRAC CLOSEBRAC EOL
argument:
NUMBER {$$.value.number = $1; $$.type = OCONFIG_TYPE_NUMBER;}
- | TRUE {$$.value.boolean = 1; $$.type = OCONFIG_TYPE_BOOLEAN;}
- | FALSE {$$.value.boolean = 0; $$.type = OCONFIG_TYPE_BOOLEAN;}
+ | BTRUE {$$.value.boolean = 1; $$.type = OCONFIG_TYPE_BOOLEAN;}
+ | BFALSE {$$.value.boolean = 0; $$.type = OCONFIG_TYPE_BOOLEAN;}
| string {$$.value.string = $1; $$.type = OCONFIG_TYPE_STRING;}
;
$$.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;
+ }
;
%%