LLmessage.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef LLNONCORR
  21. error("%s missing before %s", symbol2str(tk), symbol2str(DOT));
  22. #endif
  23. insert_token(tk);
  24. }
  25. else {
  26. #ifndef LLNONCORR
  27. error("%s deleted", symbol2str(DOT));
  28. #else
  29. error("%s not expected", symbol2str(DOT));
  30. #endif
  31. }
  32. tk_nmb_at_last_syn_err = token_nmb;
  33. }
  34. insert_token(tk)
  35. int tk;
  36. {
  37. aside = dot;
  38. DOT = tk;
  39. switch (tk) {
  40. /* The operands need some body */
  41. case IDENTIFIER:
  42. dot.tk_idf = gen_idf();
  43. break;
  44. case TYPE_IDENTIFIER:
  45. dot.tk_idf = str2idf("int");
  46. break;
  47. case STRING:
  48. dot.tk_bts = Salloc("", 1);
  49. dot.tk_len = 1;
  50. break;
  51. case INTEGER:
  52. dot.tk_fund = INT;
  53. dot.tk_ival = 1;
  54. break;
  55. #ifndef NOFLOAT
  56. case FLOATING:
  57. dot.tk_fval = Salloc("0.0", 4);
  58. break;
  59. #endif /* NOFLOAT */
  60. }
  61. }