LLlex.h.new 2.4 KB

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