mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Added explanatory comments in GenericLexer.h
This commit is contained in:
parent
fd7a2278b9
commit
66481ad279
Notes:
sideshowbarker
2024-07-19 02:13:10 +09:00
Author: https://github.com/benit8 Commit: https://github.com/SerenityOS/serenity/commit/66481ad2799 Pull-request: https://github.com/SerenityOS/serenity/pull/3610
1 changed files with 8 additions and 2 deletions
|
@ -36,6 +36,7 @@ public:
|
|||
explicit GenericLexer(const StringView& input);
|
||||
virtual ~GenericLexer();
|
||||
|
||||
// A lambda/function can be used to match characters as the user pleases
|
||||
using Condition = Function<bool(char)>;
|
||||
|
||||
size_t tell() const { return m_index; }
|
||||
|
@ -82,8 +83,13 @@ constexpr auto is_any_of(const StringView& values)
|
|||
return [values](auto c) { return values.contains(c); };
|
||||
}
|
||||
|
||||
// ctype adaptors
|
||||
// FIXME: maybe put them in an another file?
|
||||
/*
|
||||
* CType adapters: pass them as Conditions to a GenericLexer's methods
|
||||
* Examples:
|
||||
* - `if (lexer.next_is(is_digit))`
|
||||
* - `auto name = lexer.consume_while(is_alphanum);
|
||||
* - `lexer.ignore_until(is_any_of("<^>"))`
|
||||
*/
|
||||
bool is_alpha(char);
|
||||
bool is_alphanum(char);
|
||||
bool is_control(char);
|
||||
|
|
Loading…
Reference in a new issue