tokenname.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* $Header$ */
  2. #include "tokenname.h"
  3. #include "Lpars.h"
  4. #include "position.h"
  5. #include "file.h"
  6. #include "idf.h"
  7. /* To centralize the declaration of %tokens, their presence in this
  8. file is taken as their declaration. The Makefile will produce
  9. a grammar file (tokenfile.g) from this file. This scheme ensures
  10. that all tokens have a printable name.
  11. Also, the "token2str.c" file is produced from this file.
  12. */
  13. #if 0
  14. struct tokenname tkspec[] = { /* the names of the special tokens */
  15. {NAME, "name"},
  16. {STRING, "string"},
  17. {INTEGER, "number"},
  18. {EXPRESSION, "<expression>"},
  19. {REAL, "real"},
  20. {CHAR, "char"},
  21. {BIN_OP, "<operator>"},
  22. {PREF_OR_BIN_OP, "<operator>"},
  23. {PREF_OP, "<operator>"},
  24. {POST_OP, "<operator>"},
  25. {SEL_OP, "<operator>"},
  26. {0, ""}
  27. };
  28. #endif
  29. struct tokenname tkidf[] = { /* names of the identifier tokens */
  30. {LIST, "list"},
  31. {XFILE, "file"},
  32. {RUN, "run"},
  33. {RERUN, "rerun"},
  34. {STOP, "stop"},
  35. {WHEN, "when"},
  36. {AT, "at"},
  37. {IN, "in"},
  38. {ON, "on"},
  39. {IF, "if"},
  40. {CONT, "cont"},
  41. {STEP, "step"},
  42. {NEXT, "next"},
  43. {REGS, "regs"},
  44. {WHERE, "where"},
  45. {STATUS, "status"},
  46. {DELETE, "delete"},
  47. {PRINT, "print"},
  48. {DUMP, "dump"},
  49. {RESTORE, "restore"},
  50. {TRACE, "trace"},
  51. {SET, "set"},
  52. {TO, "to"},
  53. {FIND, "find"},
  54. {DISPLAY, "display"},
  55. {WHICH, "which"},
  56. {HELP, "help"},
  57. {DISABLE,"disable"},
  58. {ENABLE,"enable"},
  59. {SOURCE, "source"},
  60. {FRAME, "frame"},
  61. {LOG, "log"},
  62. {-1, "quit"},
  63. {0, ""}
  64. };
  65. #if 0
  66. struct tokenname tkinternal[] = { /* internal keywords */
  67. {0, "0"}
  68. };
  69. struct tokenname tkstandard[] = { /* standard identifiers */
  70. {0, ""}
  71. };
  72. #endif
  73. /* Some routines to handle tokennames */
  74. reserve(resv)
  75. register struct tokenname *resv;
  76. {
  77. /* The names of the tokens described in resv are entered
  78. as reserved words.
  79. */
  80. register struct idf *p;
  81. while (resv->tn_symbol) {
  82. p = str2idf(resv->tn_name, 0);
  83. if (!p) fatal("out of Memory");
  84. p->id_reserved = resv->tn_symbol;
  85. resv++;
  86. }
  87. }