Pristine Ack-5.5
[Ack-5.5.git] / lang / m2 / m2mm / tokenname.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  * Author: Ceriel J.H. Jacobs
6  */
7
8 /* T O K E N   D E F I N I T I O N S */
9
10 /* $Id: tokenname.c,v 1.2 1994/06/24 12:45:44 ceriel Exp $ */
11
12 #include        "tokenname.h"
13 #include        "Lpars.h"
14 #include        "idf.h"
15
16 /*      To centralize the declaration of %tokens, their presence in this
17         file is taken as their declaration. The Makefile will produce
18         a grammar file (tokenfile.g) from this file. This scheme ensures
19         that all tokens have a printable name.
20         Also, the "token2str.c" file is produced from this file.
21 */
22
23 #ifdef ___XXX___
24 struct tokenname tkspec[] =     {       /* the names of the special tokens */
25         {IDENT, "identifier"},
26         {STRING, "string"},
27         {INTEGER, "number"},
28         {REAL, "real"},
29         {0, ""}
30 };
31
32 struct tokenname tkcomp[] =     {       /* names of the composite tokens */
33         {LESSEQUAL, "<="},
34         {GREATEREQUAL, ">="},
35         {UPTO, ".."},
36         {BECOMES, ":="},
37         {0, ""}
38 };
39 #endif
40
41 struct tokenname tkidf[] =      {       /* names of the identifier tokens */
42         {AND, "AND"},
43         {ARRAY, "ARRAY"},
44         {BEGIN, "BEGIN"},
45         {BY, "BY"},
46         {CASE, "CASE"},
47         {CONST, "CONST"},
48         {DEFINITION, "DEFINITION"},
49         {DIV, "DIV"},
50         {DO, "DO"},
51         {ELSE, "ELSE"},
52         {ELSIF, "ELSIF"},
53         {END, "END"},
54         {EXIT, "EXIT"},
55         {EXPORT, "EXPORT"},
56         {FOR, "FOR"},
57         {FROM, "FROM"},
58         {IF, "IF"},
59         {IMPLEMENTATION, "IMPLEMENTATION"},
60         {IMPORT, "IMPORT"},
61         {IN, "IN"},
62         {LOOP, "LOOP"},
63         {MOD, "MOD"},
64         {MODULE, "MODULE"},
65         {NOT, "NOT"},
66         {OF, "OF"},
67         {OR, "OR"},
68         {POINTER, "POINTER"},
69         {PROCEDURE, "PROCEDURE"},
70         {QUALIFIED, "QUALIFIED"},
71         {RECORD, "RECORD"},
72         {REPEAT, "REPEAT"},
73         {RETURN, "RETURN"},
74         {SET, "SET"},
75         {THEN, "THEN"},
76         {TO, "TO"},
77         {TYPE, "TYPE"},
78         {UNTIL, "UNTIL"},
79         {VAR, "VAR"},
80         {WHILE, "WHILE"},
81         {WITH, "WITH"},
82         {0, ""}
83 };
84
85 #ifdef ___XXX___
86 struct tokenname tkinternal[] = {       /* internal keywords    */
87         {PROGRAM, ""},
88         {COERCION, ""},
89         {0, "0"}
90 };
91
92 struct tokenname tkstandard[] = {       /* standard identifiers */
93         {0, ""}
94 };
95 #endif
96
97 /* Some routines to handle tokennames */
98
99 reserve(resv)
100         register struct tokenname *resv;
101 {
102         /*      The names of the tokens described in resv are entered
103                 as reserved words.
104         */
105         register struct idf *p;
106
107         while (resv->tn_symbol) {
108                 p = str2idf(resv->tn_name, 0);
109                 if (!p) fatal("out of Memory");
110                 p->id_reserved = resv->tn_symbol;
111                 resv++;
112         }
113 }