tokenname.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. * Author: Ceriel J.H. Jacobs
  6. */
  7. /* T O K E N D E F I N I T I O N S */
  8. /* $Header$ */
  9. #include "tokenname.h"
  10. #include "Lpars.h"
  11. #include "position.h"
  12. #include "file.h"
  13. #include "idf.h"
  14. /* To centralize the declaration of %tokens, their presence in this
  15. file is taken as their declaration. The Makefile will produce
  16. a grammar file (tokenfile.g) from this file. This scheme ensures
  17. that all tokens have a printable name.
  18. Also, the "token2str.c" file is produced from this file.
  19. */
  20. #if 0
  21. struct tokenname tkspec[] = { /* the names of the special tokens */
  22. {NAME, "name"},
  23. {STRING, "string"},
  24. {INTEGER, "number"},
  25. {REAL, "real"},
  26. {CHAR, "char"},
  27. {0, ""}
  28. };
  29. #endif
  30. struct tokenname tkidf[] = { /* names of the identifier tokens */
  31. {LIST, "list"},
  32. {XFILE, "file"},
  33. {RUN, "run"},
  34. {RERUN, "rerun"},
  35. {STOP, "stop"},
  36. {WHEN, "when"},
  37. {AT, "at"},
  38. {IN, "in"},
  39. {ON, "on"},
  40. {IF, "if"},
  41. {CONT, "cont"},
  42. {STEP, "step"},
  43. {NEXT, "next"},
  44. {REGS, "regs"},
  45. {WHERE, "where"},
  46. {STATUS, "status"},
  47. {DELETE, "delete"},
  48. {PRINT, "print"},
  49. {DUMP, "dump"},
  50. {RESTORE, "restore"},
  51. {TRACE, "trace"},
  52. {-1, "quit"},
  53. {0, ""}
  54. };
  55. #if 0
  56. struct tokenname tkinternal[] = { /* internal keywords */
  57. {0, "0"}
  58. };
  59. struct tokenname tkstandard[] = { /* standard identifiers */
  60. {0, ""}
  61. };
  62. #endif
  63. /* Some routines to handle tokennames */
  64. reserve(resv)
  65. register struct tokenname *resv;
  66. {
  67. /* The names of the tokens described in resv are entered
  68. as reserved words.
  69. */
  70. register struct idf *p;
  71. while (resv->tn_symbol) {
  72. p = str2idf(resv->tn_name, 0);
  73. if (!p) fatal("out of Memory");
  74. p->id_reserved = resv->tn_symbol;
  75. resv++;
  76. }
  77. }