1 /* see copyright notice in squirrel.h */ 2 #ifndef _SQLEXER_H_ 3 #define _SQLEXER_H_ 4 5 #ifdef SQUNICODE 6 typedef SQChar LexChar; 7 #else 8 typedef unsigned char LexChar; 9 #endif 10 11 struct SQLexer 12 { 13 SQLexer(); 14 ~SQLexer(); 15 void Init(SQSharedState *ss,SQLEXREADFUNC rg,SQUserPointer up,CompilerErrorFunc efunc,void *ed); 16 void Error(const SQChar *err); 17 SQInteger Lex(); 18 const SQChar *Tok2Str(SQInteger tok); 19 private: 20 SQInteger GetIDType(SQChar *s); 21 SQInteger ReadString(SQInteger ndelim,bool verbatim); 22 SQInteger ReadNumber(); 23 void LexBlockComment(); 24 SQInteger ReadID(); 25 void Next(); 26 SQInteger _curtoken; 27 SQTable *_keywords; 28 public: 29 SQInteger _prevtoken; 30 SQInteger _currentline; 31 SQInteger _lasttokenline; 32 SQInteger _currentcolumn; 33 const SQChar *_svalue; 34 SQInteger _nvalue; 35 SQFloat _fvalue; 36 SQLEXREADFUNC _readf; 37 SQUserPointer _up; 38 LexChar _currdata; 39 SQSharedState *_sharedstate; 40 sqvector<SQChar> _longstr; 41 CompilerErrorFunc _errfunc; 42 void *_errtarget; 43 }; 44 45 #endif 46