ack/lang/m2/comp/LLlex.h

51 lines
1.3 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$ */
#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 {
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 */
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-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
#define TOK_REAL tk_data.tk_real->r_real
#define TOK_RVAL tk_data.tk_real->r_val
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