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
|
|
|
|
1987-04-29 10:22:07 +00:00
|
|
|
/* $Header$ */
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
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 */
|
1986-03-20 14:52:03 +00:00
|
|
|
union {
|
|
|
|
struct idf *tk_idf; /* IDENT */
|
1986-04-22 22:36:16 +00:00
|
|
|
struct string *tk_str; /* STRING */
|
1986-04-04 13:47:04 +00:00
|
|
|
arith tk_int; /* INTEGER */
|
1989-12-19 09:40:25 +00:00
|
|
|
struct real *tk_real; /* REAL */
|
1986-04-09 18:14:49 +00:00
|
|
|
arith *tk_set; /* only used in parse tree node */
|
|
|
|
struct def *tk_def; /* only used in parse tree node */
|
1986-03-20 14:52:03 +00:00
|
|
|
} tk_data;
|
|
|
|
};
|
|
|
|
|
1987-09-23 16:39:43 +00:00
|
|
|
typedef struct token t_token;
|
|
|
|
|
1986-03-20 14:52:03 +00:00
|
|
|
#define TOK_IDF tk_data.tk_idf
|
1991-03-06 10:52:34 +00:00
|
|
|
#define TOK_SSTR tk_data.tk_str
|
1986-04-22 22:36:16 +00:00
|
|
|
#define TOK_STR tk_data.tk_str->s_str
|
|
|
|
#define TOK_SLE tk_data.tk_str->s_length
|
1986-04-04 13:47:04 +00:00
|
|
|
#define TOK_INT tk_data.tk_int
|
1991-03-06 10:52:34 +00:00
|
|
|
#define TOK_REAL tk_data.tk_real
|
|
|
|
#define TOK_RSTR tk_data.tk_real->r_real
|
1989-12-19 09:40:25 +00:00
|
|
|
#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
|