diff options
| author | Sam Varshavchik | 2013-08-19 16:39:41 -0400 |
|---|---|---|
| committer | Sam Varshavchik | 2013-08-25 14:43:51 -0400 |
| commit | 9c45d9ad13fdf439d44d7443ae75da15ea0223ed (patch) | |
| tree | 7a81a04cb51efb078ee350859a64be2ebc6b8813 /maildrop/token.h | |
| parent | a9520698b770168d1f33d6301463bb70a19655ec (diff) | |
| download | courier-libs-9c45d9ad13fdf439d44d7443ae75da15ea0223ed.tar.bz2 | |
Initial checkin
Imported from subversion report, converted to git. Updated all paths in
scripts and makefiles, reflecting the new directory hierarchy.
Diffstat (limited to 'maildrop/token.h')
| -rw-r--r-- | maildrop/token.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/maildrop/token.h b/maildrop/token.h new file mode 100644 index 0000000..0a97471 --- /dev/null +++ b/maildrop/token.h @@ -0,0 +1,105 @@ +#ifndef token_h +#define token_h + + +#include "buffer.h" + +/////////////////////////////////////////////////////////////////////////// +// +// The Token class represents one syntactical element in a recipe file, such +// as a semicolon, a brace, or a text string. The Lexer class creates +// one Token after another from the recipe file. +// +/////////////////////////////////////////////////////////////////////////// + +class Token { + + Buffer buf; + +public: + enum tokentype { + error, + eof, + qstring, // Quoted string + sqstring, // Sinqle-quoted string + btstring, // Backticked string + equals, + lbrace, + rbrace, + semicolon, + regexpr, + plus, + minus, + mult, + divi, + lt, + le, + gt, + ge, + eq, + ne, + lor, + land, + bor, + band, + lparen, + rparen, + logicalnot, + bitwisenot, + slt, + sle, + sgt, + sge, + seq, + sne, + length, + substr, + comma, + strregexp, + tokenif, + tokenelse, + tokenelsif, + tokenwhile, + tokento, + tokencc, + exception, + echo, + tokenxfilter, + dotlock, + flock, + logfile, + log, + include, + exit, + foreach, + getaddr, + lookup, + escape, + to_lower, + to_upper, + hasaddr, + gdbmopen, + gdbmclose, + gdbmfetch, + gdbmstore, + timetoken, + importtoken, + unset + }; +private: + tokentype type; +public: + Token() : type(error) {} + ~Token() {} + Token(const Token &); // UNDEFINED + Token &operator=(const Token &t) { type=t.type; buf=t.buf; return (*this); } + + void Type(tokentype t) { type=t; } + void Type(tokentype t, const Buffer &tbuf) { type=t; buf=tbuf; } + tokentype Type() const { return (type); } + const Buffer &String() const { return (buf); } + Buffer &String() { return (buf); } + + const char *Name(); +} ; +#endif |
