From b3c18db46363968b9d3b98d1f7f99f8b017d9afa Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sun, 27 Mar 2022 01:57:04 +0430 Subject: [PATCH] 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. --- AK/GenericLexer.h | 5 +++++ 1 file changed, 5 insertions(+) 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("'\"");