llex.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. ** $Id: llex.h,v 1.4 1997/11/26 18:53:45 roberto Exp roberto $
  3. ** Lexical Analizer
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef llex_h
  7. #define llex_h
  8. #include "lobject.h"
  9. #include "lzio.h"
  10. #define MAX_IFS 5
  11. /* "ifstate" keeps the state of each nested $if the lexical is dealing with. */
  12. struct ifState {
  13. int elsepart; /* true if its in the $else part */
  14. int condition; /* true if $if condition is true */
  15. int skip; /* true if part must be skiped */
  16. };
  17. struct textBuff {
  18. char *text; /* always points to luaM_buffer */
  19. int tokensize;
  20. int buffsize;
  21. };
  22. typedef struct LexState {
  23. int current; /* look ahead character */
  24. struct zio *lex_z; /* input stream */
  25. int linenumber; /* input line counter */
  26. struct textBuff textbuff; /* buffer for tokens */
  27. int linelasttoken; /* line where last token was read */
  28. int lastline; /* last line wherein a SETLINE was generated */
  29. struct ifState ifstate[MAX_IFS];
  30. int iflevel; /* level of nested $if's (for lexical analysis) */
  31. } LexState;
  32. void luaX_init (void);
  33. void luaX_setinput (ZIO *z);
  34. char *luaX_lasttoken (void);
  35. #endif