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 S C R I P T O R D E F I N I T I O N */
|
1986-03-20 14:52:03 +00:00
|
|
|
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1987-04-29 10:22:07 +00:00
|
|
|
|
1989-12-19 09:40:25 +00:00
|
|
|
#include "real.h"
|
|
|
|
|
1986-09-25 19:39:06 +00:00
|
|
|
/* Structure to store a string constant
|
|
|
|
*/
|
1986-04-04 13:47:04 +00:00
|
|
|
struct string {
|
1988-04-13 18:37:45 +00:00
|
|
|
unsigned s_length; /* length of a string */
|
1986-09-25 19:39:06 +00:00
|
|
|
char *s_str; /* the string itself */
|
1986-04-04 13:47:04 +00:00
|
|
|
};
|
|
|
|
|
1991-03-12 16:52:00 +00:00
|
|
|
union tk_attr {
|
|
|
|
struct string *tk_str;
|
|
|
|
arith tk_int;
|
|
|
|
struct real *tk_real;
|
|
|
|
struct {
|
|
|
|
union {
|
|
|
|
arith *tky_set;
|
|
|
|
struct idf *tky_idf;
|
|
|
|
struct def *tky_def;
|
|
|
|
} tk_yy;
|
|
|
|
struct node *tky_next;
|
|
|
|
} tk_y;
|
|
|
|
struct {
|
|
|
|
struct node *tkx_left, *tkx_right;
|
|
|
|
} tk_x;
|
|
|
|
};
|
|
|
|
#define tk_left tk_x.tkx_left
|
|
|
|
#define tk_right tk_x.tkx_right
|
|
|
|
#define tk_next tk_y.tky_next
|
|
|
|
#define tk_idf tk_y.tk_yy.tky_idf
|
|
|
|
#define tk_def tk_y.tk_yy.tky_def
|
|
|
|
#define tk_set tk_y.tk_yy.tky_set
|
|
|
|
|
1986-09-25 19:39:06 +00:00
|
|
|
/* Token structure. Keep it small, as it is part of a parse-tree node
|
|
|
|
*/
|
1986-03-20 14:52:03 +00:00
|
|
|
struct token {
|
1986-09-25 19:39:06 +00:00
|
|
|
short tk_symb; /* token itself */
|
1986-05-23 19:25:21 +00:00
|
|
|
unsigned short tk_lineno; /* linenumber on which it occurred */
|
1991-03-12 16:52:00 +00:00
|
|
|
union tk_attr tk_data;
|
1986-03-20 14:52:03 +00:00
|
|
|
};
|
|
|
|
|
1987-09-23 16:39:43 +00:00
|
|
|
typedef struct token t_token;
|
|
|
|
|
1991-03-12 16:52:00 +00:00
|
|
|
#define TOK_IDF tk_data.tk_idf
|
|
|
|
#define TOK_SSTR tk_data.tk_str
|
|
|
|
#define TOK_STR tk_data.tk_str->s_str
|
|
|
|
#define TOK_SLE tk_data.tk_str->s_length
|
|
|
|
#define TOK_INT tk_data.tk_int
|
|
|
|
#define TOK_REAL tk_data.tk_real
|
|
|
|
#define TOK_RSTR tk_data.tk_real->r_real
|
|
|
|
#define TOK_RVAL tk_data.tk_real->r_val
|
1986-03-20 14:52:03 +00:00
|
|
|
|
1987-09-23 16:39:43 +00:00
|
|
|
extern t_token dot, aside;
|
1986-06-04 09:01:48 +00:00
|
|
|
extern struct type *toktype;
|
1986-03-20 14:52:03 +00:00
|
|
|
|
|
|
|
#define DOT dot.tk_symb
|
|
|
|
#define ASIDE aside.tk_symb
|
1991-11-27 13:40:52 +00:00
|
|
|
|
|
|
|
extern int token_nmb;
|
|
|
|
extern int tk_nmb_at_last_syn_err;
|