mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
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.
This commit is contained in:
parent
da637a05da
commit
8b3af40006
1 changed files with 8 additions and 0 deletions
|
|
@ -243,6 +243,14 @@ or { return OR_KW; }
|
|||
return HPATH;
|
||||
}
|
||||
|
||||
<PATH_START>{ANY} |
|
||||
<PATH_START><<EOF>> {
|
||||
/* 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue