Pristine Ack-5.5
[Ack-5.5.git] / lang / m2 / comp / LLlex.h
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 S C R I P T O R   D E F I N I T I O N */
9
10 /* $Id: LLlex.h,v 1.22 1994/06/24 12:39:31 ceriel Exp $ */
11
12 #include "real.h"
13
14 /* Structure to store a string constant
15 */
16 struct string {
17         unsigned s_length;              /* length of a string */
18         char *s_str;                    /* the string itself */
19 };
20
21 union tk_attr {
22         struct string *tk_str;
23         arith tk_int;
24         struct real *tk_real;
25         struct {
26                 union {
27                         arith *tky_set;
28                         struct idf *tky_idf;
29                         struct def *tky_def;
30                 } tk_yy;
31                 struct node *tky_next;
32         } tk_y;
33         struct {
34                 struct node *tkx_left, *tkx_right;
35         } tk_x;
36 };
37 #define tk_left tk_x.tkx_left
38 #define tk_right tk_x.tkx_right
39 #define tk_next tk_y.tky_next
40 #define tk_idf  tk_y.tk_yy.tky_idf
41 #define tk_def  tk_y.tk_yy.tky_def
42 #define tk_set  tk_y.tk_yy.tky_set
43
44 /* Token structure. Keep it small, as it is part of a parse-tree node
45 */
46 struct token    {
47         short tk_symb;                  /* token itself */
48         unsigned short tk_lineno;       /* linenumber on which it occurred */
49         union tk_attr tk_data;
50 };
51
52 typedef struct token    t_token;
53
54 #define TOK_IDF         tk_data.tk_idf
55 #define TOK_SSTR        tk_data.tk_str
56 #define TOK_STR         tk_data.tk_str->s_str
57 #define TOK_SLE         tk_data.tk_str->s_length
58 #define TOK_INT         tk_data.tk_int
59 #define TOK_REAL        tk_data.tk_real
60 #define TOK_RSTR        tk_data.tk_real->r_real
61 #define TOK_RVAL        tk_data.tk_real->r_val
62
63 extern t_token dot, aside;
64 extern struct type *toktype;
65
66 #define DOT     dot.tk_symb
67 #define ASIDE   aside.tk_symb
68
69 extern int      token_nmb;
70 extern int      tk_nmb_at_last_syn_err;