From 8983dda8f209b24a5579b07dfde88bf094cba811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sat, 5 Mar 2022 12:30:34 +0000 Subject: [PATCH] dfilter: Deprecate "~=" (any_ne) The representation "~= has been superseded by "!==" with the same meaning, making it superfluous and somewhat confusing. Deprecate "~=" and recommend "!==" instead. --- doc/wireshark-filter.adoc | 2 -- docbook/release-notes.adoc | 3 ++- epan/dfilter/scanner.l | 5 ++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/wireshark-filter.adoc b/doc/wireshark-filter.adoc index 41729852a4..2ae289a360 100644 --- a/doc/wireshark-filter.adoc +++ b/doc/wireshark-filter.adoc @@ -77,8 +77,6 @@ operators, their aliases and meaning: all_eq, === All fields must be equal any_ne, !== Any fields must be not equal -The operator !== (any_ne) can also be written as ~=. - === Search and match operators Additional operators exist expressed only in English, not C-like syntax: diff --git a/docbook/release-notes.adoc b/docbook/release-notes.adoc index d6c93604a8..945efe0706 100644 --- a/docbook/release-notes.adoc +++ b/docbook/release-notes.adoc @@ -53,7 +53,7 @@ They previously shipped with Npcap 1.55. PCRE2 is compatible with PCRE so the user-visible changes should be minimal. Some exotic patterns may now be invalid and require rewriting. ** Adds a new strict equality operator "===" or "all_eq". The expression "a === b" is true if and only if all a's are equal to b. - The negation of "===" can now be written as "!==" (any_ne), in addition to "~=" (introduced in Wireshark 3.6.0). + The negation of "===" can now be written as "!==" (any_ne). ** Adds the aliases "any_eq" for "==" and "all_ne" for "!=". ** Date and time can be given in UTC using ISO 8601 (with 'Z' timezone) or by appending the suffix "UTC" to the legacy formats. Otherwise local time is used. @@ -62,6 +62,7 @@ They previously shipped with Npcap 1.55. Every value with a leading colon or in between angle brackets is a literal value. See the User Guide for details. ** Floats must be written with a leading and ending digit. For example the values ".7" and "7." are now invalid as floats. It must be written "7.0" and "0.7" respectively. +** The operator "~=" is deprecated and will be removed in a future version. Use "!==" with the same meaning instead. * text2pcap and "Import from Hex Dump": ** text2pcap supports writing the output file in all the capture file formats diff --git a/epan/dfilter/scanner.l b/epan/dfilter/scanner.l index 6ab4f086f6..626600ff40 100644 --- a/epan/dfilter/scanner.l +++ b/epan/dfilter/scanner.l @@ -124,7 +124,10 @@ WORD_CHAR [][:alnum:]_:/+-] "===" return simple(TOKEN_TEST_ALL_EQ); "all_eq" return simple(TOKEN_TEST_ALL_EQ); "!==" return simple(TOKEN_TEST_ANY_NE); -"~=" return simple(TOKEN_TEST_ANY_NE); +"~=" { + add_deprecated_token(yyextra->dfw, "The operator \"~=\" is deprecated, use \"!==\" instead."); + return simple(TOKEN_TEST_ANY_NE); +} "any_ne" return simple(TOKEN_TEST_ANY_NE); ">" return simple(TOKEN_TEST_GT); "gt" return simple(TOKEN_TEST_GT); -- GitLab