]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-var-expand: Add backwards compability for older bison
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 20 Feb 2025 19:43:33 +0000 (21:43 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 20 Feb 2025 19:48:56 +0000 (21:48 +0200)
Bison 3.5.1 does not add error symbol or handling, add them ourselves.

src/lib-var-expand/var-expand-lexer.l
src/lib-var-expand/var-expand-parser.y

index 0b8433ab91b1d9dcdc70f47a13d5bec05e5b974e..6ee88cd9e299e7263e53cfd621239349c0a97c7e 100644 (file)
@@ -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) \
index 108b6a7fa0846e98e68eaa1938a2ca66a5b7316b..9c52b3324aa978ea407d2463abe716f75ff1ef72 100644 (file)
@@ -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; }
     ;
 
 %%