annotate src/tokenizer.h @ 136:f4746d8a12a3

add smtp auth rate limits
author carl
date Tue, 26 Sep 2006 13:59:14 -0700
parents 99049fdc7320
children ecb40aa3eaa5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
2b369f7db7bf start coding on new config syntax
carl
parents: 71
diff changeset
1 #ifndef tokenizer_include
2b369f7db7bf start coding on new config syntax
carl
parents: 71
diff changeset
2 #define tokenizer_include
2b369f7db7bf start coding on new config syntax
carl
parents: 71
diff changeset
3
71
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
4 #include <fstream>
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
5 #include <list>
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
6 #include <set>
83
99049fdc7320 start coding on new config syntax
carl
parents: 75
diff changeset
7 #include <stdio.h>
99049fdc7320 start coding on new config syntax
carl
parents: 75
diff changeset
8 #include <ctype.h>
71
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
9
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
10
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
11 using namespace std;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
12
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
13 struct ltstr {
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
14 bool operator()(char* s1, char* s2) const {
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
15 return strcmp(s1, s2) < 0;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
16 }
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
17 };
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
18
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
19 typedef list<ifstream *> stream_list;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
20 typedef list<char *> string_list;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
21 typedef set<char *, ltstr> string_set;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
22 typedef list<int> line_list;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
23
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
24 class TOKEN {
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
25 stream_list streams;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
26 string_list filenames;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
27 string_set filenamess;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
28 line_list linenumbers;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
29 string_list pending_tokens;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
30 string_set *include_files;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
31 bool pushed;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
32 u_char pushed_char;
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
33
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
34 void pop();
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
35 bool next_char(u_char &c);
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
36 void push_char(u_char c);
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
37
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
38 public:
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
39 TOKEN(char *fn, string_set *includes);
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
40 ~TOKEN();
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
41 bool include(char *fn);
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
42 char *next(); // return next token
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
43 int nextint();
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
44 void skipeol(); // skip to eol
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
45 void push(char *token) {pending_tokens.push_front(token);};
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
46 char *cur_fn() {return filenames.front();};
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
47 int cur_line() {return linenumbers.front();};
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
48 void token_error(const char *err);
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
49 void token_error(const char *fmt, int d, const char *s);
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
50 void token_error(const char *fmt, const char *t, const char *h);
75
1142e46be550 start coding on new config syntax
carl
parents: 73
diff changeset
51 void token_error(const char *want, const char *have);
71
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
52 void token_error();
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
53 };
dd21c8e13074 start coding on new config syntax
carl
parents:
diff changeset
54
73
2b369f7db7bf start coding on new config syntax
carl
parents: 71
diff changeset
55 #endif