ack/lang/m2/comp/LLlex.h

48 lines
1.2 KiB
C
Raw Normal View History

/*
* (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
/* $Header$ */
1986-09-25 19:39:06 +00:00
/* Structure to store a string constant
*/
1986-04-04 13:47:04 +00:00
struct string {
1986-09-25 19:39:06 +00:00
arith s_length; /* length of a string */
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 */
1986-03-20 14:52:03 +00:00
char *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-05-01 19:06:53 +00:00
label tk_lab; /* only used in parse tree node */
1986-03-20 14:52:03 +00:00
} tk_data;
};
typedef struct token t_token;
1986-03-20 14:52:03 +00:00
#define TOK_IDF tk_data.tk_idf
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
1986-06-04 09:01:48 +00:00
#define TOK_REL tk_data.tk_real
1986-03-20 14:52:03 +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