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