From: Aki Tuomi Date: Thu, 20 Feb 2025 19:43:33 +0000 (+0200) Subject: lib-var-expand: Add backwards compability for older bison X-Git-Tag: 2.4.1~169 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=90849e45612ffafd1524762f92a9dff7fb6d78d3;p=thirdparty%2Fdovecot%2Fcore.git lib-var-expand: Add backwards compability for older bison Bison 3.5.1 does not add error symbol or handling, add them ourselves. --- diff --git a/src/lib-var-expand/var-expand-lexer.l b/src/lib-var-expand/var-expand-lexer.l index 0b8433ab91..6ee88cd9e2 100644 --- a/src/lib-var-expand/var-expand-lexer.l +++ b/src/lib-var-expand/var-expand-lexer.l @@ -47,6 +47,10 @@ static size_t input_proc(char *buf, size_t size, yyscan_t scanner); yylval->str = str_new(state->pool, 32); \ } STMT_END +#ifndef VAR_EXPAND_PARSER_error +# define VAR_EXPAND_PARSER_error 256 +#endif + static int scanner_error(void *yyscanner, const char *msg); static bool append_valid_utf8(void *yyscanner, YYSTYPE *state, const char *value); #define append_valid_utf8(state, value) \ diff --git a/src/lib-var-expand/var-expand-parser.y b/src/lib-var-expand/var-expand-parser.y index 108b6a7fa0..9c52b3324a 100644 --- a/src/lib-var-expand/var-expand-parser.y +++ b/src/lib-var-expand/var-expand-parser.y @@ -235,6 +235,7 @@ expression_list: expression: VALUE { i_zero(&tmp_value); tmp_value.str = str_c($1); push_argument(state, VAR_EXPAND_PARAMETER_VALUE_TYPE_STRING, &tmp_value); push_function(state, "literal"); state->p->only_literal = TRUE;} | OCBRACE filter_list CCBRACE | PERC { i_zero(&tmp_value); tmp_value.str = "%"; push_argument(state, VAR_EXPAND_PARAMETER_VALUE_TYPE_STRING, &tmp_value); push_function(state, "literal"); state->p->only_literal = TRUE; } + | error { return -1; } ; filter_list: filter_list PIPE filter @@ -269,6 +270,7 @@ func : funcname arguments { push_function(state, $1); } ; funcname : NAME { $$ = p_strdup(state->plist->pool, str_c($1)); } + | error { return -1; } ; arguments: @@ -285,9 +287,11 @@ argument : VALUE { i_zero(&tmp_value); tmp_value.str = str_c($1); push_argument( | key EQ number { i_zero(&tmp_value); tmp_value.num = $3; push_named_argument(state, $1, VAR_EXPAND_PARAMETER_VALUE_TYPE_INT, &tmp_value); } | key EQ NAME { i_zero(&tmp_value); tmp_value.str = str_c($3); push_named_argument(state, $1, VAR_EXPAND_PARAMETER_VALUE_TYPE_VARIABLE, &tmp_value); } | key EQ VALUE { i_zero(&tmp_value); tmp_value.str = str_c($3); push_named_argument(state, $1, VAR_EXPAND_PARAMETER_VALUE_TYPE_STRING, &tmp_value); } + | error { return -1; } ; key : NAME { $$ = p_strdup(state->plist->pool, str_c($1)); } + | error { return -1; } ; %%