summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibIMAP/Parser.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-24 20:45:27 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-24 22:22:41 +0100
commit8c05b4e13778dfd908c9b65ed39f17604eb34e89 (patch)
treef24b4b8a20e31c0aa5608d42b3520df07c5663b5 /Userland/Libraries/LibIMAP/Parser.cpp
parent6502d79240dbf9cf0a5dbe3a1cda395a27ac2784 (diff)
downloadserenity-8c05b4e13778dfd908c9b65ed39f17604eb34e89.zip
LibIMAP: Rename IMAP::Parser::{parse => consume}_while()
This isn't parsing anything.
Diffstat (limited to 'Userland/Libraries/LibIMAP/Parser.cpp')
-rw-r--r--Userland/Libraries/LibIMAP/Parser.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Userland/Libraries/LibIMAP/Parser.cpp b/Userland/Libraries/LibIMAP/Parser.cpp
index 183d0d94a2..e7a5840858 100644
--- a/Userland/Libraries/LibIMAP/Parser.cpp
+++ b/Userland/Libraries/LibIMAP/Parser.cpp
@@ -22,7 +22,7 @@ ParseStatus Parser::parse(ByteBuffer&& buffer, bool expecting_tag)
if (try_consume("+")) {
consume(" ");
- auto data = parse_while([](u8 x) { return x != '\r'; });
+ auto data = consume_while([](u8 x) { return x != '\r'; });
consume("\r\n");
return { true, { ContinueRequest { data } } };
}
@@ -179,13 +179,13 @@ void Parser::parse_untagged()
m_response.data().set_permanent_flags(move(flags));
} else {
dbgln("Unknown: {}", actual_type);
- parse_while([](u8 x) { return x != ']'; });
+ consume_while([](u8 x) { return x != ']'; });
}
consume("]");
- parse_while([](u8 x) { return x != '\r'; });
+ consume_while([](u8 x) { return x != '\r'; });
consume("\r\n");
} else {
- parse_while([](u8 x) { return x != '\r'; });
+ consume_while([](u8 x) { return x != '\r'; });
consume("\r\n");
}
} else if (try_consume("SEARCH")) {
@@ -197,7 +197,7 @@ void Parser::parse_untagged()
}
m_response.data().set_search_results(move(ids));
} else if (try_consume("BYE")) {
- auto message = parse_while([](u8 x) { return x != '\r'; });
+ auto message = consume_while([](u8 x) { return x != '\r'; });
consume("\r\n");
m_response.data().set_bye(message.is_empty() ? Optional<String>() : Optional<String>(message));
} else if (try_consume("STATUS")) {
@@ -236,7 +236,7 @@ void Parser::parse_untagged()
try_consume(" "); // Not in the spec but the Outlook server sends a space for some reason.
consume("\r\n");
} else {
- auto x = parse_while([](u8 x) { return x != '\r'; });
+ auto x = consume_while([](u8 x) { return x != '\r'; });
consume("\r\n");
dbgln("ignored {}", x);
}
@@ -244,7 +244,7 @@ void Parser::parse_untagged()
StringView Parser::parse_quoted_string()
{
- auto str = parse_while([](u8 x) { return x != '"'; });
+ auto str = consume_while([](u8 x) { return x != '"'; });
consume("\"");
return str;
}
@@ -292,7 +292,7 @@ FetchResponseData Parser::parse_fetch_response()
}
case FetchCommand::DataItemType::InternalDate: {
consume(" \"");
- auto date_view = parse_while([](u8 x) { return x != '"'; });
+ auto date_view = consume_while([](u8 x) { return x != '"'; });
consume("\"");
auto date = Core::DateTime::parse("%d-%b-%Y %H:%M:%S %z", date_view).value();
fetch_response.set_internal_date(date);
@@ -574,7 +574,7 @@ ListItem Parser::parse_list_item()
flags |= static_cast<unsigned>(flag);
}
consume(" \"");
- auto reference = parse_while([](u8 x) { return x != '"'; });
+ auto reference = consume_while([](u8 x) { return x != '"'; });
consume("\" ");
auto mailbox = parse_astring();
consume("\r\n");
@@ -634,7 +634,7 @@ Vector<T> Parser::parse_list(T converter(StringView))
while (!try_consume(")")) {
if (!first)
consume(" ");
- auto item = parse_while([](u8 x) {
+ auto item = consume_while([](u8 x) {
return x != ' ' && x != ')';
});
x.append(converter(item));
@@ -677,7 +677,7 @@ MailboxFlag Parser::parse_mailbox_flag(StringView s)
return MailboxFlag::Unknown;
}
-StringView Parser::parse_while(Function<bool(u8)> should_consume)
+StringView Parser::consume_while(Function<bool(u8)> should_consume)
{
int chars = 0;
while (!at_end() && should_consume(m_buffer[position])) {
@@ -689,13 +689,13 @@ StringView Parser::parse_while(Function<bool(u8)> should_consume)
FetchCommand::DataItem Parser::parse_fetch_data_item()
{
- auto msg_attr = parse_while([](u8 x) { return is_ascii_alpha(x) != 0; });
+ auto msg_attr = consume_while([](u8 x) { return is_ascii_alpha(x) != 0; });
if (msg_attr.equals_ignoring_case("BODY") && try_consume("[")) {
auto data_item = FetchCommand::DataItem {
.type = FetchCommand::DataItemType::BodySection,
.section = { {} }
};
- auto section_type = parse_while([](u8 x) { return x != ']' && x != ' '; });
+ auto section_type = consume_while([](u8 x) { return x != ']' && x != ' '; });
if (section_type.equals_ignoring_case("HEADER.FIELDS")) {
data_item.section->type = FetchCommand::DataItem::SectionType::HeaderFields;
data_item.section->headers = Vector<String>();