From 59a5b833216b62f28c816df7c9129bf0954993e0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 25 Mar 2012 14:21:47 +0200 Subject: Change parse to push API, fix some parser bugs --- src/config.y | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/config.y') diff --git a/src/config.y b/src/config.y index 02a9529..9868d57 100644 --- a/src/config.y +++ b/src/config.y @@ -1,11 +1,11 @@ %define api.pure +%define api.push-pull push %name-prefix "fastd_config_" -%lex-param {yyscan_t scanner} %parse-param {fastd_context *ctx} %parse-param {fastd_config *conf} -%parse-param {yyscan_t scanner} %code requires { + #include #include } @@ -16,8 +16,6 @@ struct in6_addr addr6; } -%token TOK_ERROR; - %token TOK_INTEGER %token TOK_STRING %token TOK_IDENTIFIER @@ -41,11 +39,10 @@ %code { #include - #include #include #include - void fastd_config_error(fastd_context *ctx, fastd_config *conf, yyscan_t scanner, char *s); + void fastd_config_error(fastd_context *ctx, fastd_config *conf, char *s); extern fastd_protocol fastd_protocol_null; @@ -54,10 +51,6 @@ #endif } -%code provides { - #include - int fastd_config_parse (fastd_context *ctx, fastd_config *conf, void *scanner); -} %type maybe_string @@ -158,15 +151,15 @@ peer_key: TOK_STRING { free(conf->peers->key); conf->peers->key = strdup($1); } maybe_string: TOK_STRING - | { $$[0] = '\0'; } + | { $$ = ""; } ; maybe_port: ':' port { $$ = $2; } | { $$ = 0; } ; -maybe_port_default: ':' port { $$ = $2; } - | { $$ = htons(1337); } +maybe_port_default: ':' port { $$ = $2; } + | { $$ = htons(1337); } ; port: TOK_INTEGER { @@ -176,6 +169,6 @@ port: TOK_INTEGER { } ; %% -void fastd_config_error(fastd_context *ctx, fastd_config *conf, yyscan_t scanner, char *s) { +void fastd_config_error(fastd_context *ctx, fastd_config *conf, char *s) { exit_error(ctx, "config error: %s", s); } -- cgit v1.2.3