tttm

git clone https://orangeshoelaces.net/git/tttm.git

/parser.h

   1 enum {
   2         IL_7BIT, IL_8BIT, IL_ALERT, IL_APP, IL_APR, IL_ASTERISK, IL_AUDIO,
   3         IL_AUG, IL_AUTHEQ, IL_B64, IL_BAD, IL_BADCS, IL_BIN, IL_BODY,
   4         IL_BSLASH, IL_BYE, IL_CAP, IL_CBRACE, IL_CBRACK, IL_COLON, IL_CPAR,
   5         IL_DEC, IL_DHDR, IL_DNOT, IL_DOT, IL_DQUOTE, IL_DTXT, IL_ENVELOPE,
   6         IL_EOL, IL_EXISTS, IL_EXPUNGE, IL_FEB, IL_FETCH, IL_FLAGS,
   7         IL_FLANSWERED, IL_FLANY, IL_FLDELETED, IL_FLDRAFT, IL_FLFLAGGED,
   8         IL_FLMARKED, IL_FLNOINFERIORS, IL_FLNOSEL, IL_FLRECENT, IL_FLSEEN,
   9         IL_FLUNMARKED, IL_GT, IL_HDR, IL_HDRFIELDS, IL_IMG, IL_INBOX,
  10         IL_INTDATE, IL_JAN, IL_JUL, IL_JUN, IL_LIST, IL_LSUB, IL_LT, IL_MAR,
  11         IL_MAY, IL_MIME, IL_MINUS, IL_MSG, IL_MSGS, IL_NIL, IL_NO, IL_NOV,
  12         IL_OBRACE, IL_OBRACK, IL_OCT, IL_OK, IL_OPAR, IL_PARSE, IL_PERMFL,
  13         IL_PLUS, IL_PREAUTH, IL_QPRN, IL_RECENT, IL_RFC822, IL_RFC822SIZE,
  14         IL_RO, IL_RW, IL_SEARCH, IL_SEP, IL_SP, IL_STATUS, IL_STRUCT,
  15         IL_TRYC, IL_TXT, IL_UID, IL_UIDNEXT, IL_UIDVAL, IL_UNSEEN, IL_VIDEO,
  16 };
  17 
  18 enum {
  19         IP_822BODY,
  20         IP_ATOM,
  21         IP_CAP,
  22         IP_CAPDATA,
  23         IP_CONTREQ,
  24         IP_EXISTS,
  25         IP_EXPUNGE,
  26         IP_FETCH,
  27         IP_RESPAUTH,
  28         IP_RESPBYE,
  29         IP_RESPDATA,
  30         IP_RESPSTATE,
  31         IP_RESPTXTCODE,
  32         IP_TAGGEDRESP,
  33 };
  34 
  35 enum { PN_INTER, PN_LIT, PN_NUM, PN_STR, PN_QSTR, PN_LSTR };
  36 
  37 union parnode {
  38         int type;
  39         struct {
  40                 int type;
  41                 int prod;
  42                 size_t len;
  43         } inter;
  44         struct {
  45                 int type;
  46                 int val;
  47         } lit;
  48         struct {
  49                 int type;
  50                 uint32_t val;
  51         } num;
  52         struct {
  53                 int type;
  54                 uint32_t len;
  55                 size_t off;
  56         } str;
  57 };
  58 
  59 int     par_parseln(int, char **, size_t *, size_t *, size_t *,
  60     union parnode *, size_t);
  61 union parnode *par_nn(union parnode *);
  62 union parnode *par_sel(union parnode *, ...);
  63 union parnode *par_seld(union parnode *, ...);