tokenname.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /* TOKEN NAME DEFINITIONS */
  7. #include "idf.h"
  8. #include "arith.h"
  9. #include "LLlex.h"
  10. #include "Lpars.h"
  11. struct tokenname { /* Used for defining the name of a
  12. token as identified by its symbol
  13. */
  14. int tn_symbol;
  15. char *tn_name;
  16. };
  17. /* To centralize the declaration of %tokens, their presence in this
  18. file is taken as their declaration. The Makefile will produce
  19. a grammar file (tokenfile.g) from this file.
  20. Moreover, rather than looking up a symbol in all these lists
  21. to find its printable name, a fast version of symbol2str() is
  22. generated from these tables.
  23. Consequenty some of these tables are not referenced explicitly
  24. in the C text any more. To save space and to avoid lint confusion,
  25. these have been made pseudo-invisible by #ifdefs.
  26. */
  27. #ifdef ____
  28. struct tokenname tkspec[] = { /* the names of the special tokens */
  29. {IDENTIFIER, "identifier"},
  30. {STRING, "string"},
  31. {FILESPECIFIER, "filespecifier"},
  32. {INTEGER, "integer"},
  33. {0, ""}
  34. };
  35. struct tokenname tkcomp[] = { /* names of the composite tokens */
  36. {PLUSAB, "+="},
  37. {MINAB, "-="},
  38. {TIMESAB, "*="},
  39. {DIVAB, "/="},
  40. {MODAB, "%="},
  41. {LEFTAB, "<<="},
  42. {RIGHTAB, ">>="},
  43. {ANDAB, "&="},
  44. {XORAB, "^="},
  45. {ORAB, "|="},
  46. {NOTEQUAL, "!="},
  47. {AND, "&&"},
  48. {PLUSPLUS, "++"},
  49. {MINMIN, "--"},
  50. {ARROW, "->"},
  51. {LEFT, "<<"},
  52. {LESSEQ, "<="},
  53. {EQUAL, "=="},
  54. {GREATEREQ, ">="},
  55. {RIGHT, ">>"},
  56. {OR, "||"},
  57. {ELLIPSIS, "..."},
  58. {0, ""}
  59. };
  60. struct tokenname tkfunny[] = { /* internal keywords */
  61. {ERRONEOUS, "erroneous"},
  62. {0, ""}
  63. };
  64. #endif /* ____ */