sqlexer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* see copyright notice in squirrel.h */
  2. #ifndef _SQLEXER_H_
  3. #define _SQLEXER_H_
  4. #ifdef SQUNICODE
  5. typedef SQChar LexChar;
  6. #else
  7. typedef unsigned char LexChar;
  8. #endif
  9. struct SQLexer
  10. {
  11. SQLexer();
  12. ~SQLexer();
  13. void Init(SQSharedState *ss,SQLEXREADFUNC rg,SQUserPointer up,CompilerErrorFunc efunc,void *ed);
  14. void Error(const SQChar *err);
  15. SQInteger Lex();
  16. const SQChar *Tok2Str(SQInteger tok);
  17. private:
  18. SQInteger GetIDType(const SQChar *s,SQInteger len);
  19. SQInteger ReadString(SQInteger ndelim,bool verbatim);
  20. SQInteger ReadNumber();
  21. void LexBlockComment();
  22. void LexLineComment();
  23. SQInteger ReadID();
  24. void Next();
  25. SQInteger _curtoken;
  26. SQTable *_keywords;
  27. SQBool _reached_eof;
  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. #endif