X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fparser.y;h=ca0844e4acc782f3058b9dd2b8565be378d8152d;hb=f96b1aa398e1a6a480aac8ff3128ec8e093a5aaf;hp=82e89a987a307e28a5f00bd9f8cff3da02cbd04a;hpb=8d61bc461d8acc2dc2df8837ba5e7b34eda58522;p=liboconfig.git diff --git a/src/parser.y b/src/parser.y index 82e89a9..ca0844e 100644 --- a/src/parser.y +++ b/src/parser.y @@ -2,6 +2,7 @@ #include #include #include "oconfig.h" +#include "scanner.h" struct statement_list_s { @@ -51,6 +52,7 @@ static void dump_ci (oconfig_item_t *ci, int shift); %type option %type statement %type statement_list +%type entire_file %% string: @@ -163,33 +165,12 @@ statement_list: entire_file: statement_list { - int i; - for (i = 0; i < $1.statement_num; i++) - dump_ci ($1.statement + i, 0); + $$.children = $1.statement; + $$.children_num = $1.statement.num; } ; %% -#include "lex.yy.c" - -/* -void yyerror (char *s) -{ - fprintf (stderr, "%s\n", s); -} - -int yylex (void) -{ - return (getc (stdin)); -} -*/ - -int main (int argc, char **argv) -{ - yyparse (); - return (0); -} - static char *unquote (const char *orig) { char *ret = strdup (orig);