LLmessage.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. /* PARSER ERROR ADMINISTRATION */
  7. #include <alloc.h>
  8. #include "idf.h"
  9. #include "arith.h"
  10. #include "LLlex.h"
  11. #include "Lpars.h"
  12. extern char *symbol2str();
  13. LLmessage(tk) {
  14. err_occurred = 1;
  15. if (tk < 0) {
  16. error("end of file expected");
  17. }
  18. else if (tk) {
  19. #ifndef LLNONCORR
  20. error("%s missing before %s", symbol2str(tk), symbol2str(DOT));
  21. #endif
  22. insert_token(tk);
  23. }
  24. else {
  25. #ifndef LLNONCORR
  26. error("%s deleted", symbol2str(DOT));
  27. #else
  28. error("%s not expected", symbol2str(DOT));
  29. #endif
  30. }
  31. tk_nmb_at_last_syn_err = token_nmb;
  32. }
  33. insert_token(tk)
  34. int tk;
  35. {
  36. aside = dot;
  37. DOT = tk;
  38. switch (tk) {
  39. /* The operands need some body */
  40. case IDENTIFIER:
  41. dot.tk_idf = gen_idf();
  42. break;
  43. case TYPE_IDENTIFIER:
  44. dot.tk_idf = str2idf("int", 0);
  45. break;
  46. case STRING:
  47. dot.tk_bts = Salloc("", 1);
  48. dot.tk_len = 1;
  49. break;
  50. case INTEGER:
  51. dot.tk_fund = INT;
  52. dot.tk_ival = 1;
  53. break;
  54. case FLOATING:
  55. dot.tk_fval = Salloc("0.0", 4);
  56. break;
  57. }
  58. }