LLmessage.c 1.1 KB

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