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