summaryrefslogtreecommitdiff
path: root/src/include/recursivedescent.h
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 19:28:50 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 19:28:50 +0200
commit3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (patch)
treeae78ebf9e9d1f70da8a6fdad1504063644ee8f1e /src/include/recursivedescent.h
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/include/recursivedescent.h')
-rw-r--r--src/include/recursivedescent.h71
1 files changed, 38 insertions, 33 deletions
diff --git a/src/include/recursivedescent.h b/src/include/recursivedescent.h
index ea8dc67..1200211 100644
--- a/src/include/recursivedescent.h
+++ b/src/include/recursivedescent.h
@@ -1,15 +1,14 @@
/**
- * @file recursivedescent.h
- * @brief Declaration of a recursive descent IMAP command parser.
- * @author Andreas Aardal Hanssen
- * @date Andreas Aardal Hanssen
+ * @file recursivedescent.h
+ * @brief Declaration of a recursive descent IMAP command parser.
+ * @author Andreas Aardal Hanssen, Jannis M. Hoffmann
+ * @date 2002-2023
*/
#ifndef expectcommand_h_inluded
#define expectcommand_h_inluded
#include "imapparser.h"
-#include "operators.h"
#include <stack>
#include <string>
@@ -23,44 +22,50 @@ namespace Binc {
void unReadChar(int c_in);
void unReadChar(const std::string &s_in);
- Operator::ParseResult expectTag(std::string &s_in);
- Operator::ParseResult expectTagChar(int &c_in);
- Operator::ParseResult expectSPACE();
+ namespace Parser {
+ enum class ParseResult { ACCEPT, REJECT, ERROR, TIMEOUT };
+ }
- Operator::ParseResult expectFlag(std::vector<std::string> &v_in);
+ using ParseResult = Parser::ParseResult;
- Operator::ParseResult expectListMailbox(std::string &s_in);
- Operator::ParseResult expectListWildcards(int &c_in);
+ ParseResult expectTag(std::string &s_in);
+ ParseResult expectTagChar(int &c_in);
+ ParseResult expectSPACE();
- Operator::ParseResult expectDateTime(std::string &s_in);
- Operator::ParseResult expectTime(std::string &s_in);
- Operator::ParseResult expectZone(std::string &s_in);
+ ParseResult expectFlag(std::vector<std::string> &v_in);
- Operator::ParseResult expectMailbox(std::string &s_in);
- Operator::ParseResult expectAstring(std::string &s_in);
- Operator::ParseResult expectAtom(std::string &s_in);
- Operator::ParseResult expectAtomChar(int &i_in);
- Operator::ParseResult expectString(std::string &s_in);
+ ParseResult expectListMailbox(std::string &s_in);
+ ParseResult expectListWildcards(int &c_in);
- Operator::ParseResult expectDate(std::string &s_in);
+ ParseResult expectDateTime(std::string &s_in);
+ ParseResult expectTime(std::string &s_in);
+ ParseResult expectZone(std::string &s_in);
- Operator::ParseResult expectNumber(unsigned int &i_in);
- Operator::ParseResult expectDigit(unsigned int &i_in);
- Operator::ParseResult expectDigitNZ(unsigned int &i_in);
+ ParseResult expectMailbox(std::string &s_in);
+ ParseResult expectAstring(std::string &s_in);
+ ParseResult expectAtom(std::string &s_in);
+ ParseResult expectAtomChar(int &i_in);
+ ParseResult expectString(std::string &s_in);
- Operator::ParseResult expectLiteral(std::string &s_in);
- Operator::ParseResult expectQuoted(std::string &s_in);
- Operator::ParseResult expectQuotedChar(int &c_in);
+ ParseResult expectDate(std::string &s_in);
- Operator::ParseResult expectSet(SequenceSet &s_in);
- Operator::ParseResult expectSequenceNum(unsigned int &i_in);
- Operator::ParseResult expectNZNumber(unsigned int &i_in);
+ ParseResult expectNumber(unsigned int &i_in);
+ ParseResult expectDigit(unsigned int &i_in);
+ ParseResult expectDigitNZ(unsigned int &i_in);
- Operator::ParseResult expectCRLF();
- Operator::ParseResult expectCR();
- Operator::ParseResult expectLF();
+ ParseResult expectLiteral(std::string &s_in);
+ ParseResult expectQuoted(std::string &s_in);
+ ParseResult expectQuotedChar(int &c_in);
- Operator::ParseResult expectThisString(const std::string &s_in);
+ ParseResult expectSet(SequenceSet &s_in);
+ ParseResult expectSequenceNum(unsigned int &i_in);
+ ParseResult expectNZNumber(unsigned int &i_in);
+
+ ParseResult expectCRLF();
+ ParseResult expectCR();
+ ParseResult expectLF();
+
+ ParseResult expectThisString(const std::string &s_in);
}
#endif