From 1c48fbaf2af691f9484dd988afd62044fa797f42 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 15 Apr 2024 11:54:34 +0200 Subject: [PATCH] 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 --- libsmartcols/src/filter-scanner.l | 2 ++ libsmartcols/src/filter.c | 1 + 2 files changed, 3 insertions(+) diff --git a/libsmartcols/src/filter-scanner.l b/libsmartcols/src/filter-scanner.l index 501b603b1d..5d2571d157 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 dccf05cf01..e0c1c7ae0b 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); -- 2.47.3