LLlex.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. /* 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 */
  7. /* A token from the input stream is represented by an integer,
  8. called a "symbol", but it may have other information associated
  9. to it.
  10. */
  11. #include "nofloat.h"
  12. #include "file_info.h"
  13. #include "nopp.h"
  14. /* the structure of a token: */
  15. struct token {
  16. int tok_symb; /* the token itself */
  17. char *tok_file; /* the file it (probably) comes from */
  18. unsigned int tok_line; /* the line it (probably) comes from */
  19. union {
  20. struct idf *tok_idf; /* for IDENTIFIER & TYPE_IDENTIFIER */
  21. struct { /* for STRING */
  22. char *tok_bts; /* row of bytes */
  23. int tok_len; /* length of row of bytes */
  24. } tok_string;
  25. struct { /* for INTEGER */
  26. int tok_fund; /* INT or LONG */
  27. arith tok_ival;
  28. } tok_integer;
  29. #ifndef NOFLOAT
  30. char *tok_fval;
  31. #endif /* NOFLOAT */
  32. } tok_data;
  33. };
  34. #define tk_symb tok_symb
  35. #define tk_file tok_file
  36. #define tk_line tok_line
  37. #define tk_idf tok_data.tok_idf
  38. #define tk_bts tok_data.tok_string.tok_bts
  39. #define tk_len tok_data.tok_string.tok_len
  40. #define tk_fund tok_data.tok_integer.tok_fund
  41. #define tk_ival tok_data.tok_integer.tok_ival
  42. #ifndef NOFLOAT
  43. #define tk_fval tok_data.tok_fval
  44. #endif /* NOFLOAT */
  45. extern struct token dot, ahead, aside;
  46. extern int token_nmb; /* number of the ahead token */
  47. extern int tk_nmb_at_last_syn_err; /* token number at last syntax error */
  48. #ifndef NOPP
  49. extern int ReplaceMacros; /* "LLlex.c" */
  50. extern int AccDefined; /* "LLlex.c" */
  51. extern int Unstacked; /* "LLlex.c" */
  52. extern int UnknownIdIsZero; /* "LLlex.c" */
  53. #endif /* NOPP */
  54. extern int EoiForNewline; /* "LLlex.c" */
  55. extern int AccFileSpecifier; /* "LLlex.c" */
  56. extern int SkipEscNewline; /* "LLlex.c" */
  57. extern int File_Inserted; /* "LLlex.c" */
  58. extern int NoUnstack; /* buffer.c */
  59. extern int err_occurred; /* "error.c" */
  60. #define DOT dot.tk_symb
  61. #define AHEAD ahead.tk_symb
  62. #define ASIDE aside.tk_symb
  63. #define EOF (-1)