LLlex.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* $Header$ */
  2. /* D E F I N I T I O N S F O R T H E L E X I C A L A N A L Y Z E R */
  3. /* A token from the input stream is represented by an integer,
  4. called a "symbol", but it may have other information associated
  5. to it.
  6. */
  7. #include "nofloat.h"
  8. #include "file_info.h"
  9. /* the structure of a token: */
  10. struct token {
  11. int tok_symb; /* the token itself */
  12. char *tok_file; /* the file it (probably) comes from */
  13. unsigned int tok_line; /* the line it (probably) comes from */
  14. union {
  15. struct idf *tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
  16. struct { /* for STRING */
  17. char *tok_bts; /* row of bytes */
  18. int tok_len; /* length of row of bytes */
  19. } tok_string;
  20. struct { /* for INTEGER */
  21. int tok_fund; /* INT or LONG */
  22. arith tok_ival;
  23. } tok_integer;
  24. #ifndef NOFLOAT
  25. char *tok_fval;
  26. #endif NOFLOAT
  27. } tok_data;
  28. };
  29. #define tk_symb tok_symb
  30. #define tk_file tok_file
  31. #define tk_line tok_line
  32. #define tk_idf tok_data.tok_idf
  33. #define tk_bts tok_data.tok_string.tok_bts
  34. #define tk_len tok_data.tok_string.tok_len
  35. #define tk_fund tok_data.tok_integer.tok_fund
  36. #define tk_ival tok_data.tok_integer.tok_ival
  37. #ifndef NOFLOAT
  38. #define tk_fval tok_data.tok_fval
  39. #endif NOFLOAT
  40. extern struct token dot, ahead, aside;
  41. extern int ReplaceMacros; /* "LLlex.c" */
  42. extern int EoiForNewline; /* "LLlex.c" */
  43. extern int PreProcKeys; /* "LLlex.c" */
  44. extern int AccFileSpecifier; /* "LLlex.c" */
  45. extern int AccDefined; /* "LLlex.c" */
  46. extern int UnknownIdIsZero; /* "LLlex.c" */
  47. extern int SkipEscNewline; /* "LLlex.c" */
  48. extern int Unstacked; /* "LLlex.c" */
  49. extern int NoUnstack; /* buffer.c */
  50. extern int err_occurred; /* "error.c" */
  51. #define DOT dot.tk_symb
  52. #define AHEAD ahead.tk_symb
  53. #define ASIDE aside.tk_symb
  54. #define EOF (-1)