#include <Lexer.h>
Public Member Functions | |
| Lexer (const char *fn=NULL) | |
| void | close () |
| void | open (const char *fn) |
| int | eof () |
| string | curToken () |
| string | getToken () |
| void | putbackToken (string token) |
| int | isFlag (const string &token, const char *strg, int *flag) |
Private Attributes | |
| const char * | _fn |
| std::ifstream | _is |
| string | _tok |
| string | _buf |
| int | _line |
| const char * | _cbuf |
| const char * | _cbufp |
Definition at line 18 of file Lexer.h.
|
|
Definition at line 31 of file Lexer.h.
|
|
|
Definition at line 35 of file Lexer.h.
|
|
|
Definition at line 56 of file Lexer.h. References _tok.
00056 {
00057 return _tok;
00058 }
|
|
|
Definition at line 52 of file Lexer.h. References _is. Referenced by Config::read().
00052 {
00053 return _is.eof();
00054 }
|
|
|
Definition at line 60 of file Lexer.h. References _buf, _cbuf, _cbufp, _is, _line, _tok, ERROR_LOCATION, and nlreadline(). Referenced by MPList::read(), Config::read(), AccessList::read(), AccessList::readClient(), and MPList::readServer().
00060 {
00061 const char *q;
00062 while (!(*_cbufp)) {
00063 if (!_is.good())
00064 throw IOError("Stream bad", -1,
00065 ERROR_LOCATION);
00066 _line++;
00067 nlreadline(_is, _buf, 0);
00068 if (_is.eof())
00069 return "";
00070 if (!_is.good())
00071 throw IOError("Stream bad", -1,
00072 ERROR_LOCATION);
00073 _cbufp = _cbuf = _buf.c_str();
00074 while (isspace(*_cbufp))
00075 _cbufp++;
00076 if (*_cbufp == '#')
00077 _cbufp = _cbuf + _buf.length();
00078 }
00079 q = _cbufp;
00080 while (*q && !isspace(*q))
00081 q++;
00082 _tok.assign(_cbufp, q - _cbufp);
00083 _cbufp = q;
00084 while (isspace(*_cbufp))
00085 _cbufp++;
00086 return _tok;
00087 }
|
|
||||||||||||||||
|
Definition at line 94 of file Lexer.h.
00094 {
00095 const char *ctok = token.c_str();
00096 if (strcmp(ctok, strg) == 0) {
00097 *flag = 1;
00098 return 1;
00099 }
00100 if (strncmp(ctok, "not-", 4) == 0
00101 && strcmp(ctok + 4, strg) == 0) {
00102 *flag = 0;
00103 return 1;
00104 }
00105 return 0;
00106 }
|
|
|
Definition at line 42 of file Lexer.h. References _buf, _cbuf, _cbufp, _fn, _is, _line, and ERROR_LOCATION. Referenced by Lexer().
|
|
|
Definition at line 89 of file Lexer.h. References _buf, _cbuf, and _cbufp. Referenced by Config::read(), AccessList::readClient(), and MPList::readServer().
|
|
|
Definition at line 26 of file Lexer.h. Referenced by getToken(), open(), and putbackToken(). |
|
|
Definition at line 28 of file Lexer.h. Referenced by getToken(), open(), and putbackToken(). |
|
|
Definition at line 29 of file Lexer.h. Referenced by getToken(), open(), and putbackToken(). |
|
|
Definition at line 21 of file Lexer.h. Referenced by Lexer(), open(), and SyntaxError::SyntaxError(). |
|
|
Definition at line 22 of file Lexer.h. Referenced by eof(), getToken(), and open(). |
|
|
Definition at line 27 of file Lexer.h. Referenced by getToken(), open(), and SyntaxError::SyntaxError(). |
|
|
Definition at line 24 of file Lexer.h. Referenced by curToken(), and getToken(). |
1.3.6-20040222