summaryrefslogtreecommitdiff
path: root/src/operator-append.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 21:49:37 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 21:49:37 +0200
commitbc946633e0bcae5fe63528ad743bcc67de7e347d (patch)
tree7a3d127148c13d84e92f38c319fb5aad1e88a6cb /src/operator-append.cc
parent3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (diff)
created a Parser class
Diffstat (limited to 'src/operator-append.cc')
-rw-r--r--src/operator-append.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/operator-append.cc b/src/operator-append.cc
index 0e856ba..fdebad6 100644
--- a/src/operator-append.cc
+++ b/src/operator-append.cc
@@ -249,7 +249,7 @@ Operator::ProcessResult AppendOperator::process(Depot &depot, Request &command)
return ProcessResult::OK;
}
-Parser::ParseResult AppendOperator::parse(Request &c_in)
+Parser::ParseResult AppendOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -258,49 +258,49 @@ Parser::ParseResult AppendOperator::parse(Request &c_in)
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after APPEND");
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after APPEND SPACE");
return res;
}
c_in.setMailbox(mailbox);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after APPEND SPACE mailbox");
return res;
}
- if ((res = expectThisString("(")) == ACCEPT) {
- if ((res = expectFlag(c_in.getFlags())) == ACCEPT) {
+ if ((res = p.expectThisString("(")) == ACCEPT) {
+ if ((res = p.expectFlag(c_in.getFlags())) == ACCEPT) {
while (1) {
- if ((res = expectSPACE()) != ACCEPT) break;
- if ((res = expectFlag(c_in.getFlags())) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) break;
+ if ((res = p.expectFlag(c_in.getFlags())) != ACCEPT) {
session.setLastError("expected a flag after the '('");
return res;
}
}
}
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("expected a ')'");
return res;
}
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("expected a SPACE after the flag list");
return res;
}
}
string date;
- if ((res = expectDateTime(date)) == ACCEPT) {
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectDateTime(date)) == ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("expected a SPACE after date_time");
return res;
}