1987-04-29 10:22:07 +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".
|
|
|
|
*
|
|
|
|
* Author: Ceriel J.H. Jacobs
|
|
|
|
*/
|
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
/* T O K E N D E F I N I T I O N S */
|
|
|
|
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1987-04-29 10:22:07 +00:00
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
#include "tokenname.h"
|
|
|
|
#include "Lpars.h"
|
|
|
|
#include "idf.h"
|
1986-03-20 14:52:03 +00:00
|
|
|
|
|
|
|
/* To centralize the declaration of %tokens, their presence in this
|
|
|
|
file is taken as their declaration. The Makefile will produce
|
|
|
|
a grammar file (tokenfile.g) from this file. This scheme ensures
|
|
|
|
that all tokens have a printable name.
|
|
|
|
Also, the "token2str.c" file is produced from this file.
|
|
|
|
*/
|
|
|
|
|
1987-05-18 15:57:33 +00:00
|
|
|
#ifdef ___XXX___
|
1986-03-20 14:52:03 +00:00
|
|
|
struct tokenname tkspec[] = { /* the names of the special tokens */
|
|
|
|
{IDENT, "identifier"},
|
|
|
|
{STRING, "string"},
|
1986-12-01 10:06:53 +00:00
|
|
|
{INTEGER, "number"},
|
1986-03-20 14:52:03 +00:00
|
|
|
{REAL, "real"},
|
|
|
|
{0, ""}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tokenname tkcomp[] = { /* names of the composite tokens */
|
|
|
|
{LESSEQUAL, "<="},
|
|
|
|
{GREATEREQUAL, ">="},
|
|
|
|
{UPTO, ".."},
|
|
|
|
{BECOMES, ":="},
|
|
|
|
{0, ""}
|
|
|
|
};
|
1987-05-18 15:57:33 +00:00
|
|
|
#endif
|
1986-03-20 14:52:03 +00:00
|
|
|
|
|
|
|
struct tokenname tkidf[] = { /* names of the identifier tokens */
|
|
|
|
{AND, "AND"},
|
|
|
|
{ARRAY, "ARRAY"},
|
|
|
|
{BEGIN, "BEGIN"},
|
|
|
|
{BY, "BY"},
|
|
|
|
{CASE, "CASE"},
|
|
|
|
{CONST, "CONST"},
|
|
|
|
{DEFINITION, "DEFINITION"},
|
|
|
|
{DIV, "DIV"},
|
|
|
|
{DO, "DO"},
|
|
|
|
{ELSE, "ELSE"},
|
|
|
|
{ELSIF, "ELSIF"},
|
|
|
|
{END, "END"},
|
|
|
|
{EXIT, "EXIT"},
|
|
|
|
{EXPORT, "EXPORT"},
|
|
|
|
{FOR, "FOR"},
|
|
|
|
{FROM, "FROM"},
|
|
|
|
{IF, "IF"},
|
|
|
|
{IMPLEMENTATION, "IMPLEMENTATION"},
|
|
|
|
{IMPORT, "IMPORT"},
|
|
|
|
{IN, "IN"},
|
|
|
|
{LOOP, "LOOP"},
|
|
|
|
{MOD, "MOD"},
|
|
|
|
{MODULE, "MODULE"},
|
|
|
|
{NOT, "NOT"},
|
|
|
|
{OF, "OF"},
|
|
|
|
{OR, "OR"},
|
|
|
|
{POINTER, "POINTER"},
|
|
|
|
{PROCEDURE, "PROCEDURE"},
|
|
|
|
{QUALIFIED, "QUALIFIED"},
|
|
|
|
{RECORD, "RECORD"},
|
|
|
|
{REPEAT, "REPEAT"},
|
|
|
|
{RETURN, "RETURN"},
|
|
|
|
{SET, "SET"},
|
|
|
|
{THEN, "THEN"},
|
|
|
|
{TO, "TO"},
|
|
|
|
{TYPE, "TYPE"},
|
|
|
|
{UNTIL, "UNTIL"},
|
|
|
|
{VAR, "VAR"},
|
|
|
|
{WHILE, "WHILE"},
|
|
|
|
{WITH, "WITH"},
|
|
|
|
{0, ""}
|
|
|
|
};
|
|
|
|
|
1987-05-18 15:57:33 +00:00
|
|
|
#ifdef ___XXX___
|
1986-03-20 14:52:03 +00:00
|
|
|
struct tokenname tkinternal[] = { /* internal keywords */
|
1986-03-26 15:11:02 +00:00
|
|
|
{PROGRAM, ""},
|
1987-07-30 13:37:39 +00:00
|
|
|
{COERCION, ""},
|
1988-04-06 18:14:50 +00:00
|
|
|
{CAST, ""},
|
1986-03-20 14:52:03 +00:00
|
|
|
{0, "0"}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tokenname tkstandard[] = { /* standard identifiers */
|
|
|
|
{0, ""}
|
|
|
|
};
|
1987-05-18 15:57:33 +00:00
|
|
|
#endif
|
1986-03-20 14:52:03 +00:00
|
|
|
|
|
|
|
/* Some routines to handle tokennames */
|
|
|
|
|
|
|
|
reserve(resv)
|
|
|
|
register struct tokenname *resv;
|
|
|
|
{
|
|
|
|
/* The names of the tokens described in resv are entered
|
|
|
|
as reserved words.
|
|
|
|
*/
|
1987-09-23 16:39:43 +00:00
|
|
|
register t_idf *p;
|
1986-03-20 14:52:03 +00:00
|
|
|
|
|
|
|
while (resv->tn_symbol) {
|
|
|
|
p = str2idf(resv->tn_name, 0);
|
1986-11-05 14:33:00 +00:00
|
|
|
if (!p) fatal("out of Memory");
|
1986-03-20 14:52:03 +00:00
|
|
|
p->id_reserved = resv->tn_symbol;
|
|
|
|
resv++;
|
|
|
|
}
|
|
|
|
}
|