The Squirrel interpreter. See http://www.squirrel-lang.org/
squirrel/sqlexer.h@3:7268a3ceaffc, 2014-12-16 (annotated)
- Committer:
- jhnwkmn
- Date:
- Tue Dec 16 11:39:42 2014 +0000
- Revision:
- 3:7268a3ceaffc
- Parent:
- 0:97a4f8cc534c
Accepts \r as line terminator as well.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jhnwkmn | 0:97a4f8cc534c | 1 | /* see copyright notice in squirrel.h */ |
jhnwkmn | 0:97a4f8cc534c | 2 | #ifndef _SQLEXER_H_ |
jhnwkmn | 0:97a4f8cc534c | 3 | #define _SQLEXER_H_ |
jhnwkmn | 0:97a4f8cc534c | 4 | |
jhnwkmn | 0:97a4f8cc534c | 5 | #ifdef SQUNICODE |
jhnwkmn | 0:97a4f8cc534c | 6 | typedef SQChar LexChar; |
jhnwkmn | 0:97a4f8cc534c | 7 | #else |
jhnwkmn | 0:97a4f8cc534c | 8 | typedef unsigned char LexChar; |
jhnwkmn | 0:97a4f8cc534c | 9 | #endif |
jhnwkmn | 0:97a4f8cc534c | 10 | |
jhnwkmn | 0:97a4f8cc534c | 11 | struct SQLexer |
jhnwkmn | 0:97a4f8cc534c | 12 | { |
jhnwkmn | 0:97a4f8cc534c | 13 | SQLexer(); |
jhnwkmn | 0:97a4f8cc534c | 14 | ~SQLexer(); |
jhnwkmn | 0:97a4f8cc534c | 15 | void Init(SQSharedState *ss,SQLEXREADFUNC rg,SQUserPointer up,CompilerErrorFunc efunc,void *ed); |
jhnwkmn | 0:97a4f8cc534c | 16 | void Error(const SQChar *err); |
jhnwkmn | 0:97a4f8cc534c | 17 | SQInteger Lex(); |
jhnwkmn | 0:97a4f8cc534c | 18 | const SQChar *Tok2Str(SQInteger tok); |
jhnwkmn | 0:97a4f8cc534c | 19 | private: |
jhnwkmn | 0:97a4f8cc534c | 20 | SQInteger GetIDType(SQChar *s); |
jhnwkmn | 0:97a4f8cc534c | 21 | SQInteger ReadString(SQInteger ndelim,bool verbatim); |
jhnwkmn | 0:97a4f8cc534c | 22 | SQInteger ReadNumber(); |
jhnwkmn | 0:97a4f8cc534c | 23 | void LexBlockComment(); |
jhnwkmn | 0:97a4f8cc534c | 24 | void LexLineComment(); |
jhnwkmn | 0:97a4f8cc534c | 25 | SQInteger ReadID(); |
jhnwkmn | 0:97a4f8cc534c | 26 | void Next(); |
jhnwkmn | 0:97a4f8cc534c | 27 | SQInteger _curtoken; |
jhnwkmn | 0:97a4f8cc534c | 28 | SQTable *_keywords; |
jhnwkmn | 0:97a4f8cc534c | 29 | SQBool _reached_eof; |
jhnwkmn | 0:97a4f8cc534c | 30 | public: |
jhnwkmn | 0:97a4f8cc534c | 31 | SQInteger _prevtoken; |
jhnwkmn | 0:97a4f8cc534c | 32 | SQInteger _currentline; |
jhnwkmn | 0:97a4f8cc534c | 33 | SQInteger _lasttokenline; |
jhnwkmn | 0:97a4f8cc534c | 34 | SQInteger _currentcolumn; |
jhnwkmn | 0:97a4f8cc534c | 35 | const SQChar *_svalue; |
jhnwkmn | 0:97a4f8cc534c | 36 | SQInteger _nvalue; |
jhnwkmn | 0:97a4f8cc534c | 37 | SQFloat _fvalue; |
jhnwkmn | 0:97a4f8cc534c | 38 | SQLEXREADFUNC _readf; |
jhnwkmn | 0:97a4f8cc534c | 39 | SQUserPointer _up; |
jhnwkmn | 0:97a4f8cc534c | 40 | LexChar _currdata; |
jhnwkmn | 0:97a4f8cc534c | 41 | SQSharedState *_sharedstate; |
jhnwkmn | 0:97a4f8cc534c | 42 | sqvector<SQChar> _longstr; |
jhnwkmn | 0:97a4f8cc534c | 43 | CompilerErrorFunc _errfunc; |
jhnwkmn | 0:97a4f8cc534c | 44 | void *_errtarget; |
jhnwkmn | 0:97a4f8cc534c | 45 | }; |
jhnwkmn | 0:97a4f8cc534c | 46 | |
jhnwkmn | 0:97a4f8cc534c | 47 | #endif |