summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-03-27 01:57:04 +0430
committerAndreas Kling <kling@serenityos.org>2022-03-28 23:11:48 +0200
commitb3c18db46363968b9d3b98d1f7f99f8b017d9afa (patch)
tree51868beb98b2706d080bad8ac7383da064a6533d /AK
parente21fa158dd6e06d53fe7a4c3ba25fc392515ca69 (diff)
downloadserenity-b3c18db46363968b9d3b98d1f7f99f8b017d9afa.zip
AK: Add a 'is_not_any_of' similar to 'is_any_of' to GenericLexer
It's often useful to have the negated version, so instead of making a local lambda for it, let's just add the negated form too.
Diffstat (limited to 'AK')
-rw-r--r--AK/GenericLexer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/AK/GenericLexer.h b/AK/GenericLexer.h
index 3c317782d4..57649f9840 100644
--- a/AK/GenericLexer.h
+++ b/AK/GenericLexer.h
@@ -229,6 +229,11 @@ constexpr auto is_any_of(StringView values)
return [values](auto c) { return values.contains(c); };
}
+constexpr auto is_not_any_of(StringView values)
+{
+ return [values](auto c) { return !values.contains(c); };
+}
+
constexpr auto is_path_separator = is_any_of("/\\");
constexpr auto is_quote = is_any_of("'\"");