Skip to content

Commit

Permalink
cfg-lex.l: drop the leading space/comma from tokens also in filterx mode
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Jan 16, 2024
1 parent b08a3f0 commit d40ae6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cfg-lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ yy_filter_input(CfgLexer *self, gchar *buf, gsize buf_size)

#define YY_BREAK \
do { \
if (yyextra->token_text && YY_START == INITIAL) \
if (yyextra->token_text && (YY_START == INITIAL || YY_START == filterx)) \
{ \
g_string_append_len(yyextra->token_pretext, yyextra->token_text->str, yyextra->token_text->len); \
g_string_truncate(yyextra->token_text, 0); \
Expand Down Expand Up @@ -333,7 +333,7 @@ word [^ \#'"\(\)\{\}\[\]\\;\r\n\t,|\.@:]
/* and this is the version in filterx, which only allows "traditional" identifiers */
<filterx>[a-zA-Z][_a-zA-Z0-9]* { return cfg_lexer_map_word_to_token(yyextra, yylval, yylloc, yytext); }
<INITIAL>\, ;
<INITIAL>\, ;
<INITIAL,filterx>\" {
g_string_truncate(yyextra->string_buffer, 0);
Expand Down

0 comments on commit d40ae6e

Please sign in to comment.