import of gcc-2.8
[official-gcc.git] / gcc / cp / lex.h
blob8df6b76a270baa4c15c983bd2210efb14cd776ec
1 /* Define constants and variables for communication with parse.y.
2 Copyright (C) 1987, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
4 and by Brendan Kehoe (brendan@cygnus.com).
6 This file is part of GNU CC.
8 GNU CC is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY. No author or distributor
10 accepts responsibility to anyone for the consequences of using it
11 or for whether it serves any particular purpose or works at all,
12 unless he says so in writing. Refer to the GNU CC General Public
13 License for full details.
15 Everyone is granted permission to copy, modify and redistribute
16 GNU CC, but only under the conditions described in the
17 GNU CC General Public License. A copy of this license is
18 supposed to have been given to you along with GNU CC so you
19 can know your rights and responsibilities. It should be in a
20 file named COPYING. Among other things, the copyright notice
21 and this notice must be preserved on all copies. */
25 enum rid
27 RID_UNUSED,
28 RID_INT,
29 RID_BOOL,
30 RID_CHAR,
31 RID_WCHAR,
32 RID_FLOAT,
33 RID_DOUBLE,
34 RID_VOID,
36 /* C++ extension */
37 RID_CLASS,
38 RID_RECORD,
39 RID_UNION,
40 RID_ENUM,
41 RID_LONGLONG,
43 /* This is where grokdeclarator starts its search when setting the specbits.
44 The first seven are in the order of most frequently used, as found
45 building libg++. */
47 RID_EXTERN,
48 RID_CONST,
49 RID_LONG,
50 RID_TYPEDEF,
51 RID_UNSIGNED,
52 RID_SHORT,
53 RID_INLINE,
55 RID_STATIC,
57 RID_REGISTER,
58 RID_VOLATILE,
59 RID_FRIEND,
60 RID_VIRTUAL,
61 RID_EXPLICIT,
62 RID_SIGNED,
63 RID_AUTO,
64 RID_MUTABLE,
65 RID_COMPLEX,
67 /* This is where grokdeclarator ends its search when setting the
68 specbits. */
70 RID_PUBLIC,
71 RID_PRIVATE,
72 RID_PROTECTED,
73 RID_EXCEPTION,
74 RID_TEMPLATE,
75 RID_SIGNATURE,
76 RID_NULL,
77 /* Before adding enough to get up to 64, the RIDBIT_* macros
78 will have to be changed a little. */
79 RID_MAX
82 #define NORID RID_UNUSED
84 #define RID_FIRST_MODIFIER RID_EXTERN
85 #define RID_LAST_MODIFIER RID_COMPLEX
87 /* The type that can represent all values of RIDBIT. */
88 /* We assume that we can stick in at least 32 bits into this. */
89 typedef struct { unsigned long idata[2]; }
90 RID_BIT_TYPE;
92 /* Be careful, all these modify N twice. */
93 #define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32)) \
94 & (V).idata[(N)/32])
95 #define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV))
96 #define RIDBIT_SET(N, V) do { \
97 (V).idata[(N)/32] \
98 |= ((unsigned long)1 << (int) ((N)%32)); \
99 } while (0)
100 #define RIDBIT_RESET(N, V) do { \
101 (V).idata[(N)/32] \
102 &= ~((unsigned long)1 << (int) ((N)%32)); \
103 } while (0)
104 #define RIDBIT_RESET_ALL(V) do { \
105 (V).idata[0] = 0; \
106 (V).idata[1] = 0; \
107 } while (0)
108 #define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
110 /* The elements of `ridpointers' are identifier nodes
111 for the reserved type names and storage classes.
112 It is indexed by a RID_... value. */
113 extern tree ridpointers[(int) RID_MAX];
115 /* the declaration found for the last IDENTIFIER token read in.
116 yylex must look this up to detect typedefs, which get token type TYPENAME,
117 so it is left around in case the identifier is not a typedef but is
118 used in a context which makes it a reference to a variable. */
119 extern tree lastiddecl;
121 extern char *token_buffer; /* Pointer to token buffer. */
123 /* Back-door communication channel to the lexer. */
124 extern int looking_for_typename;
125 extern int looking_for_template;
127 /* Tell the lexer where to look for names. */
128 extern tree got_scope;
129 extern tree got_object;
131 /* Pending language change.
132 Positive is push count, negative is pop count. */
133 extern int pending_lang_change;
135 extern int yylex PROTO((void));