diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-25 14:21:47 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-25 14:21:47 +0200 |
commit | 59a5b833216b62f28c816df7c9129bf0954993e0 (patch) | |
tree | 64c35f8ddcc8eafa9e12663b8eb12ba836ea1886 /src/config.y | |
parent | 6ce20e2bb6660694e995d890f2846fc26c96c8f7 (diff) | |
download | fastd-59a5b833216b62f28c816df7c9129bf0954993e0.tar fastd-59a5b833216b62f28c816df7c9129bf0954993e0.zip |
Change parse to push API, fix some parser bugs
Diffstat (limited to 'src/config.y')
-rw-r--r-- | src/config.y | 21 |
1 files changed, 7 insertions, 14 deletions
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 <fastd.h> #include <arpa/inet.h> } @@ -16,8 +16,6 @@ struct in6_addr addr6; } -%token <str> TOK_ERROR; - %token <num> TOK_INTEGER %token <str> TOK_STRING %token <str> TOK_IDENTIFIER @@ -41,11 +39,10 @@ %code { #include <config.h> - #include <config.ll.h> #include <stdint.h> #include <peer.h> - 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 <fastd.h> - int fastd_config_parse (fastd_context *ctx, fastd_config *conf, void *scanner); -} %type <str> 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); } |