LLmessage.c 838 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* $Header$ */
  2. /* PARSER ERROR ADMINISTRATION */
  3. #include "idf.h"
  4. #include "alloc.h"
  5. #include "arith.h"
  6. #include "LLlex.h"
  7. #include "Lpars.h"
  8. extern char *symbol2str();
  9. LLmessage(tk) {
  10. err_occurred = 1;
  11. if (tk < 0)
  12. fatal("parser administration overflow");
  13. if (tk) {
  14. error("%s missing", symbol2str(tk));
  15. insert_token(tk);
  16. }
  17. else
  18. error("%s deleted", symbol2str(DOT));
  19. }
  20. insert_token(tk)
  21. int tk;
  22. {
  23. aside = dot;
  24. DOT = tk;
  25. switch (tk) {
  26. /* The operands need some body */
  27. case IDENTIFIER:
  28. dot.tk_idf = gen_idf();
  29. break;
  30. case TYPE_IDENTIFIER:
  31. dot.tk_idf = str2idf("int");
  32. break;
  33. case STRING:
  34. dot.tk_bts = Salloc("", 1);
  35. dot.tk_len = 1;
  36. break;
  37. case INTEGER:
  38. dot.tk_fund = INT;
  39. dot.tk_ival = 1;
  40. break;
  41. #ifndef NOFLOAT
  42. case FLOATING:
  43. dot.tk_fval = Salloc("0.0", 4);
  44. break;
  45. #endif NOFLOAT
  46. }
  47. }