dfilter: Remove deprecated support for whitespace separator in sets
This commit is contained in:
parent
6d52bf07a7
commit
f78ebe1564
|
@ -115,8 +115,7 @@ The following features are new (or have been significantly updated) since versio
|
|||
contradiction (a == b and a != b) being true.
|
||||
** Use the syntax "a ~= b" or "a any_ne b" to recover the previous (inconsistent with ==) logic for not equal.
|
||||
** Adds support for the syntax "a not in b" as a synonym for "not a in b".
|
||||
** Set elements must now be separated using a comma (,). A filter such as http.request.method in {"GET" "HEAD"} must be written as ... in {"GET", "HEAD"}.
|
||||
(Whitespace is of course optional.) The previous use of whitespace as separator is deprecated and will be removed in a future version.
|
||||
** Set elements must be separated using a comma, e.g: {1, 2, "foo"}. Using only whitespace as separator was deprecated in 3.6 and is now a syntax error.
|
||||
|
||||
* Corrected calculation of mean jitter in RTP Stream Analysis dialog and IAX2 Stram Analysis dialog
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ typedef struct {
|
|||
dfwork_t *dfw;
|
||||
GString* quoted_string;
|
||||
gboolean raw_string;
|
||||
gboolean in_set; /* true if parsing set elements for the membership operator */
|
||||
} df_scanner_state_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -311,7 +311,6 @@ const char *tokenstr(int token)
|
|||
case TOKEN_TEST_IN: return "TEST_IN";
|
||||
case TOKEN_LBRACE: return "LBRACE";
|
||||
case TOKEN_RBRACE: return "RBRACE";
|
||||
case TOKEN_WHITESPACE: return "WHITESPACE";
|
||||
case TOKEN_DOTDOT: return "DOTDOT";
|
||||
case TOKEN_LPAREN: return "LPAREN";
|
||||
case TOKEN_RPAREN: return "RPAREN";
|
||||
|
@ -380,7 +379,6 @@ dfilter_compile(const gchar *text, dfilter_t **dfp, gchar **err_msg)
|
|||
|
||||
state.dfw = dfw;
|
||||
state.quoted_string = NULL;
|
||||
state.in_set = FALSE;
|
||||
state.raw_string = FALSE;
|
||||
|
||||
df_set_extra(&state, scanner);
|
||||
|
|
|
@ -256,16 +256,6 @@ set_list(L) ::= set_element(N).
|
|||
L = g_slist_concat(NULL, N);
|
||||
}
|
||||
|
||||
set_list(L) ::= set_list(P) WHITESPACE set_element(N).
|
||||
{
|
||||
L = g_slist_concat(P, N);
|
||||
|
||||
add_deprecated_token(dfw,
|
||||
"Use ',' to separate set elements. "
|
||||
"The use of whitespace as separator in sets is "
|
||||
"deprecated and will be removed in a future version.");
|
||||
}
|
||||
|
||||
set_list(L) ::= set_list(P) COMMA set_element(N).
|
||||
{
|
||||
L = g_slist_concat(P, N);
|
||||
|
|
|
@ -100,35 +100,14 @@ static int set_lval_str(int token, const char *token_value);
|
|||
|
||||
%%
|
||||
|
||||
[[:blank:]\n]+ {
|
||||
/* Ignore whitespace, unless set elements are being parsed. Perhaps it
|
||||
* should have used commas from the beginning, but now we are stuck with
|
||||
* whitespace as separators. */
|
||||
if (yyextra->in_set) {
|
||||
return set_lval_str(TOKEN_WHITESPACE, " ");
|
||||
}
|
||||
}
|
||||
[[:blank:]\n]+
|
||||
|
||||
"(" return simple(TOKEN_LPAREN);
|
||||
")" return simple(TOKEN_RPAREN);
|
||||
|
||||
[[:blank:]\n]*","[[:blank:]\n]* {
|
||||
return set_lval_str(TOKEN_COMMA, ",");
|
||||
}
|
||||
|
||||
"{"[[:blank:]\n]* {
|
||||
yyextra->in_set = TRUE;
|
||||
return set_lval_str(TOKEN_LBRACE, "{");
|
||||
}
|
||||
|
||||
[[:blank:]\n]*".."[[:blank:]\n]* {
|
||||
return set_lval_str(TOKEN_DOTDOT, "..");
|
||||
}
|
||||
|
||||
[[:blank:]\n]*"}" {
|
||||
yyextra->in_set = FALSE;
|
||||
return set_lval_str(TOKEN_RBRACE, "}");
|
||||
}
|
||||
"," return simple(TOKEN_COMMA);
|
||||
"{" return simple(TOKEN_LBRACE);
|
||||
".." return simple(TOKEN_DOTDOT);
|
||||
"}" return simple(TOKEN_RBRACE);
|
||||
|
||||
"==" return simple(TOKEN_TEST_ANY_EQ);
|
||||
"eq" return simple(TOKEN_TEST_ANY_EQ);
|
||||
|
|
|
@ -90,7 +90,3 @@ class case_syntax(unittest.TestCase):
|
|||
def test_deprecated_2(self, checkDFilterSucceed):
|
||||
dfilter = "bootp"
|
||||
checkDFilterSucceed(dfilter, "Deprecated tokens: \"bootp\"")
|
||||
|
||||
def test_deprecated_3(self, checkDFilterSucceed):
|
||||
dfilter = "ip.version in {4 6}"
|
||||
checkDFilterSucceed(dfilter, "Use ',' to separate set elements")
|
||||
|
|
Loading…
Reference in New Issue