aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/settings
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2014-05-13 10:50:36 +0200
committerTobias Brunner <tobias@strongswan.org>2014-05-15 11:28:09 +0200
commitda45f9e994f61324a058def37fbafd5cce75b5f3 (patch)
tree49e9c2e0db9d6291373de3b301cb98589cb10456 /src/libstrongswan/settings
parent813e510d69b27ab25cfab01cc89dd34ad3927e73 (diff)
downloadstrongswan-da45f9e994f61324a058def37fbafd5cce75b5f3.tar.bz2
strongswan-da45f9e994f61324a058def37fbafd5cce75b5f3.tar.xz
settings: Replace deprecated YYLEX_PARAM with %lex-param
With Bison 3.x support for YYLEX_PARAM has been removed and %lex-param should be used. Unfortunately, that option does not take expressions. Instead we use a wrapper function that calls the lexer with the proper scanner object, which should also be backward compatible to older Bison versions.
Diffstat (limited to 'src/libstrongswan/settings')
-rw-r--r--src/libstrongswan/settings/settings_parser.y10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstrongswan/settings/settings_parser.y b/src/libstrongswan/settings/settings_parser.y
index f4a4431c7..b79faf6b7 100644
--- a/src/libstrongswan/settings/settings_parser.y
+++ b/src/libstrongswan/settings/settings_parser.y
@@ -50,9 +50,13 @@ static void add_section(parser_helper_t *ctx, section_t *section);
static void add_setting(parser_helper_t *ctx, kv_t *kv);
/**
- * Make sure the generated parser code passes the correct object to the lexer
+ * Make sure to call lexer with the proper context
*/
-#define YYLEX_PARAM ctx->scanner
+#undef yylex
+static int yylex(YYSTYPE *lvalp, parser_helper_t *ctx)
+{
+ return settings_parser_lex(lvalp, ctx->scanner);
+}
%}
%debug
@@ -65,7 +69,7 @@ static void add_setting(parser_helper_t *ctx, kv_t *kv);
%name-prefix "settings_parser_"
/* interact properly with the reentrant lexer */
-%lex-param {void *scanner}
+%lex-param {parser_helper_t *ctx}
%parse-param {parser_helper_t *ctx}
/* types for terminal symbols... (can't use the typedef'd types) */