1989-02-07 11:04:05 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1994-06-27 08:03:14 +00:00
|
|
|
/* $Id$ */
|
1989-02-07 11:04:05 +00:00
|
|
|
/* PARSER ERROR ADMINISTRATION */
|
|
|
|
|
|
|
|
#include <alloc.h>
|
2013-05-18 11:15:53 +00:00
|
|
|
#include "idf.h"
|
1989-02-07 11:04:05 +00:00
|
|
|
#include "arith.h"
|
|
|
|
#include "LLlex.h"
|
|
|
|
#include "Lpars.h"
|
2019-02-18 16:42:15 +00:00
|
|
|
#include "error.h"
|
1989-02-07 11:04:05 +00:00
|
|
|
|
|
|
|
extern char *symbol2str();
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
static void insert_token(int );
|
|
|
|
|
|
|
|
void LLmessage(int tk)
|
|
|
|
{
|
1989-02-07 11:04:05 +00:00
|
|
|
err_occurred = 1;
|
2019-02-18 16:42:15 +00:00
|
|
|
if (tk < 0)
|
|
|
|
{
|
1989-02-07 11:04:05 +00:00
|
|
|
error("end of file expected");
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else if (tk)
|
|
|
|
{
|
1997-02-21 17:11:04 +00:00
|
|
|
#ifndef LLNONCORR
|
1989-11-17 11:27:26 +00:00
|
|
|
error("%s missing before %s", symbol2str(tk), symbol2str(DOT));
|
1997-02-21 17:11:04 +00:00
|
|
|
#endif
|
1989-02-07 11:04:05 +00:00
|
|
|
insert_token(tk);
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else
|
|
|
|
{
|
1997-02-21 17:11:04 +00:00
|
|
|
#ifndef LLNONCORR
|
1989-02-07 11:04:05 +00:00
|
|
|
error("%s deleted", symbol2str(DOT));
|
1997-02-21 17:11:04 +00:00
|
|
|
#else
|
|
|
|
error("%s not expected", symbol2str(DOT));
|
|
|
|
#endif
|
1989-11-08 16:52:34 +00:00
|
|
|
}
|
|
|
|
tk_nmb_at_last_syn_err = token_nmb;
|
1989-02-07 11:04:05 +00:00
|
|
|
}
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
static void insert_token(int tk)
|
1989-02-07 11:04:05 +00:00
|
|
|
{
|
|
|
|
aside = dot;
|
|
|
|
|
|
|
|
DOT = tk;
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
switch (tk)
|
|
|
|
{
|
1989-02-07 11:04:05 +00:00
|
|
|
/* The operands need some body */
|
|
|
|
case IDENTIFIER:
|
|
|
|
dot.tk_idf = gen_idf();
|
|
|
|
break;
|
|
|
|
case TYPE_IDENTIFIER:
|
1991-06-19 16:12:56 +00:00
|
|
|
dot.tk_idf = str2idf("int", 0);
|
1989-02-07 11:04:05 +00:00
|
|
|
break;
|
|
|
|
case STRING:
|
|
|
|
dot.tk_bts = Salloc("", 1);
|
|
|
|
dot.tk_len = 1;
|
|
|
|
break;
|
|
|
|
case INTEGER:
|
|
|
|
dot.tk_fund = INT;
|
|
|
|
dot.tk_ival = 1;
|
|
|
|
break;
|
|
|
|
case FLOATING:
|
|
|
|
dot.tk_fval = Salloc("0.0", 4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|