annotate src/tokenizer.h @ 42:d9ae11033b4b stable-1-9

Add default config to firewall systems that send bounces to non-existant accounts. Switch to Mercurial source control. Update spec file for fedora packaging.
author Carl Byington <carl@five-ten-sg.com>
date Fri, 21 Mar 2008 14:02:32 -0700
parents 6a2f26976898
children ba0259c9e411
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 9
diff changeset
1 /*
1
551433a01cab initial coding
carl
parents:
diff changeset
2
36
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 9
diff changeset
3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 9
diff changeset
4 the GPL version 3 or any later version at your choice available at
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 9
diff changeset
5 http://www.gnu.org/licenses/gpl-3.0.txt
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 9
diff changeset
6
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 9
diff changeset
7 */
1
551433a01cab initial coding
carl
parents:
diff changeset
8
551433a01cab initial coding
carl
parents:
diff changeset
9
551433a01cab initial coding
carl
parents:
diff changeset
10 using namespace std;
551433a01cab initial coding
carl
parents:
diff changeset
11
551433a01cab initial coding
carl
parents:
diff changeset
12 struct ltstr {
551433a01cab initial coding
carl
parents:
diff changeset
13 bool operator()(char* s1, char* s2) const {
551433a01cab initial coding
carl
parents:
diff changeset
14 return strcmp(s1, s2) < 0;
551433a01cab initial coding
carl
parents:
diff changeset
15 }
551433a01cab initial coding
carl
parents:
diff changeset
16 };
551433a01cab initial coding
carl
parents:
diff changeset
17
551433a01cab initial coding
carl
parents:
diff changeset
18 typedef list<ifstream *> stream_list;
551433a01cab initial coding
carl
parents:
diff changeset
19 typedef list<char *> string_list;
551433a01cab initial coding
carl
parents:
diff changeset
20 typedef set<char *, ltstr> string_set;
551433a01cab initial coding
carl
parents:
diff changeset
21 typedef list<int> line_list;
551433a01cab initial coding
carl
parents:
diff changeset
22
551433a01cab initial coding
carl
parents:
diff changeset
23 class TOKEN {
551433a01cab initial coding
carl
parents:
diff changeset
24 stream_list streams;
551433a01cab initial coding
carl
parents:
diff changeset
25 string_list filenames;
551433a01cab initial coding
carl
parents:
diff changeset
26 string_set filenamess;
551433a01cab initial coding
carl
parents:
diff changeset
27 line_list linenumbers;
551433a01cab initial coding
carl
parents:
diff changeset
28 string_list pending_tokens;
551433a01cab initial coding
carl
parents:
diff changeset
29 string_set *include_files;
551433a01cab initial coding
carl
parents:
diff changeset
30 bool pushed;
551433a01cab initial coding
carl
parents:
diff changeset
31 u_char pushed_char;
551433a01cab initial coding
carl
parents:
diff changeset
32
551433a01cab initial coding
carl
parents:
diff changeset
33 void pop();
551433a01cab initial coding
carl
parents:
diff changeset
34 bool next_char(u_char &c);
551433a01cab initial coding
carl
parents:
diff changeset
35 void push_char(u_char c);
551433a01cab initial coding
carl
parents:
diff changeset
36
551433a01cab initial coding
carl
parents:
diff changeset
37 public:
551433a01cab initial coding
carl
parents:
diff changeset
38 TOKEN(char *fn, string_set *includes);
551433a01cab initial coding
carl
parents:
diff changeset
39 ~TOKEN();
5
276c4edc8521 initial coding
carl
parents: 1
diff changeset
40 bool include(char *fn);
276c4edc8521 initial coding
carl
parents: 1
diff changeset
41 char *next(); // return next token
276c4edc8521 initial coding
carl
parents: 1
diff changeset
42 int nextint();
276c4edc8521 initial coding
carl
parents: 1
diff changeset
43 void skipeol(); // skip to eol
276c4edc8521 initial coding
carl
parents: 1
diff changeset
44 void push(char *token) {pending_tokens.push_front(token);};
276c4edc8521 initial coding
carl
parents: 1
diff changeset
45 const char *cur_fn() {return filenames.empty() ? "" : filenames.front();};
276c4edc8521 initial coding
carl
parents: 1
diff changeset
46 int cur_line() {return linenumbers.empty() ? 0 : linenumbers.front();};
276c4edc8521 initial coding
carl
parents: 1
diff changeset
47 void token_error(const char *err);
276c4edc8521 initial coding
carl
parents: 1
diff changeset
48 void token_error(const char *fmt, int d, const char *s);
276c4edc8521 initial coding
carl
parents: 1
diff changeset
49 void token_error(const char *fmt, const char *t, const char *h);
276c4edc8521 initial coding
carl
parents: 1
diff changeset
50 void token_error(const char *want, const char *have);
276c4edc8521 initial coding
carl
parents: 1
diff changeset
51 void token_error();
1
551433a01cab initial coding
carl
parents:
diff changeset
52 };
551433a01cab initial coding
carl
parents:
diff changeset
53