From 8b3af40006079b4181de35b8562ef78aff6bf4f0 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Costa Date: Wed, 29 Oct 2025 17:19:17 +0000 Subject: [PATCH] fix(libexpr/lexer): fix flex warning about default rule We were getting this flex lexer warning during build: ``` ../src/libexpr/lexer.l:333: warning, -s option given but default rule can be matched ``` The lexer uses `%option nodefault` but the `PATH_START` state only had rules for specific patterns (`PATH_SEG` and `HPATH_START`) without a catch-all rule to handle unexpected input. Added a catch-all rule with `unreachable()`. This code path should never be reached in normal operation since `PATH_START` is only entered after matching `PATH_SEG` or `HPATH_START`, and we immediately rewind to re-parse those same patterns. The catch-all exists solely to satisfy flex's `%option nodefault` requirement. --- src/libexpr/lexer.l | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 74a9065a4..810503bdc 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -243,6 +243,14 @@ or { return OR_KW; } return HPATH; } +{ANY} | +<> { + /* This should be unreachable: PATH_START is only entered after matching + PATH_SEG or HPATH_START, and we rewind to re-parse those same patterns. + This rule exists to satisfy flex's %option nodefault requirement. */ + unreachable(); +} + {PATH} { if (yytext[yyleng-1] == '/') PUSH_STATE(INPATH_SLASH);