summaryrefslogtreecommitdiff
path: root/src/include/recursivedescent.h
blob: ea8fe33320c2838e7c9a0b33e4c6324ed6ed84f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**  --------------------------------------------------------------------
 *  @file recursivedescent.h
 *  @brief  Declaration of a recursive descent IMAP command parser.
 *  @author Andreas Aardal Hanssen
 *  @date Andreas Aardal Hanssen
 *  -----------------------------------------------------------------  **/
#ifndef expectcommand_h_inluded
#define expectcommand_h_inluded
#include <stack>
#include <string>

#include "imapparser.h"
#include "operators.h"

namespace Binc {

  extern std::stack<int> inputBuffer;
  extern int charnr;

  int readChar(void);
  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(void);

  Operator::ParseResult expectFlag(std::vector<std::string> &v_in);

  Operator::ParseResult expectListMailbox(std::string &s_in);
  Operator::ParseResult expectListWildcards(int &c_in);

  Operator::ParseResult expectDateTime(std::string &s_in);
  Operator::ParseResult expectTime(std::string &s_in);
  Operator::ParseResult expectZone(std::string &s_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);
    
  Operator::ParseResult expectDate(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);

  Operator::ParseResult expectLiteral(std::string &s_in);
  Operator::ParseResult expectQuoted(std::string &s_in);
  Operator::ParseResult expectQuotedChar(int &c_in);

  Operator::ParseResult expectSet(SequenceSet &s_in);
  Operator::ParseResult expectSequenceNum(unsigned int &i_in);
  Operator::ParseResult expectNZNumber(unsigned int &i_in);

  Operator::ParseResult expectCRLF(void);
  Operator::ParseResult expectCR(void);
  Operator::ParseResult expectLF(void);

  Operator::ParseResult expectThisString(const std::string &s_in);
}

#endif