From: Karel Zak Date: Mon, 15 Apr 2024 09:54:34 +0000 (+0200) Subject: libsmartcols; (filter) make libscols_filter accessible in lex X-Git-Tag: v2.42-start~410 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c48fbaf2af691f9484dd988afd62044fa797f42;p=thirdparty%2Futil-linux.git libsmartcols; (filter) make libscols_filter accessible in lex In the reentrant parser, we cannot easily extend the argument list for yylex() using %lex-param. Instead, we must use a lex-extra pointer. Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/filter-scanner.l b/libsmartcols/src/filter-scanner.l index 501b603b1..5d2571d15 100644 --- a/libsmartcols/src/filter-scanner.l +++ b/libsmartcols/src/filter-scanner.l @@ -1,9 +1,11 @@ %{ #include "smartcolsP.h" #include "filter-parser.h" /* define tokens (T_*) */ + %} %option reentrant bison-bridge noyywrap noinput nounput +%option extra-type="struct libscols_filter *" id [a-zA-Z][a-zA-Z_.%:/\-0-9]* int [0-9]+ diff --git a/libsmartcols/src/filter.c b/libsmartcols/src/filter.c index dccf05cf0..e0c1c7ae0 100644 --- a/libsmartcols/src/filter.c +++ b/libsmartcols/src/filter.c @@ -196,6 +196,7 @@ int scols_filter_parse_string(struct libscols_filter *fltr, const char *str) return -errno; yylex_init(&sc); + yylex_init_extra(fltr, &sc); yyset_in(fltr->src, sc); rc = yyparse(sc, fltr);