%{ #define YYSTYPE char #define YYERROR_VERBOSE #include #include #include "conf.h" #include "conf_parser.h" void yyerror(const char *str) { fprintf(stderr, "error: %s\n", str); } %} %debug %defines %locations %token NEWLINE READONLY TOKDEBUG MOUNTPOINT LOGFILE LOGLEVEL PKGDIR DBTYPE DBPATH %token NUMBER %token INTEGER %token WORD %token STRING %token FILENAME %union { int number; char *string; } %% commands: /* empty */ | commands command NEWLINE ; command: readonly | debug | mountpoint; readonly: READONLY { conf->readonly = true; } ; debug: TOKDEBUG { conf->debug = true; } ; mountpoint: MOUNTPOINT FILENAME { conf->mountpoint = $2; } ; %%