Skip to content

Commit

Permalink
Merge pull request #185 from alltilla/slash-string-leave-the-backslas…
Browse files Browse the repository at this point in the history
…h-alone

cfg-lex: implement "Leave the backslash alone" for slash_string
  • Loading branch information
bshifter authored Jul 3, 2024
2 parents 8347012 + ab1b1d7 commit 068246f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cfg-lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ filterx_word [^ \#'"/\(\)\{\}\[\]\\;\r\n\t,|\.@:]
<slash_string>\\f { g_string_append_c(yyextra->string_buffer, 12); }
<slash_string>\\\\ { g_string_append_c(yyextra->string_buffer, '\\'); }
<slash_string>\\\/ { g_string_append_c(yyextra->string_buffer, '/'); }
<slash_string>\\[^anrtvbfox] { g_string_append_c(yyextra->string_buffer, yytext[1]); }
<slash_string>\\[^anrtvbfox] { g_string_append(yyextra->string_buffer, yytext); }
<slash_string>[^\/\\\r\n]+ { g_string_append(yyextra->string_buffer, yytext); }
<slash_string>\/ {
yy_pop_state(yyscanner);
Expand Down
2 changes: 2 additions & 0 deletions tests/light/functional_tests/filterx/test_filterx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@ def test_slash_string_features(config, syslog_ng):
$MSG.escaped_slash = /foo\/bar/;
$MSG.non_escaped_single_quotes = /foo'bar/;
$MSG.non_escaped_double_quotes = /foo"bar/;
$MSG.escaped_non_special = /foo\dbar/;
## special characters
$MSG.new_line = /foo\nbar/;
Expand Down Expand Up @@ -1725,6 +1726,7 @@ def test_slash_string_features(config, syslog_ng):
r""""escaped_slash":"foo\/bar","""
r""""non_escaped_single_quotes":"foo'bar","""
r""""non_escaped_double_quotes":"foo\"bar","""
r""""escaped_non_special":"foo\\dbar","""
r""""new_line":"foo\nbar","""
r""""tab":"foo\tbar","""
r""""carrige_return":"foo\rbar","""
Expand Down

0 comments on commit 068246f

Please sign in to comment.