1999-10-04 Mark Mitchell <mark@codesourcery.com>
[official-gcc.git] / gcc / cp / lex.h
blob337e55aa7ca4e6e8e74c08481886596300dcc197
1 /* Define constants and variables for communication with parse.y.
2 Copyright (C) 1987, 92-97, 1998 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++. */
46 RID_FIRST_MODIFIER,
48 RID_EXTERN = RID_FIRST_MODIFIER,
49 RID_CONST,
50 RID_LONG,
51 RID_TYPEDEF,
52 RID_UNSIGNED,
53 RID_SHORT,
54 RID_INLINE,
56 RID_STATIC,
58 RID_REGISTER,
59 RID_VOLATILE,
60 RID_FRIEND,
61 RID_VIRTUAL,
62 RID_EXPLICIT,
63 RID_EXPORT,
64 RID_SIGNED,
65 RID_AUTO,
66 RID_MUTABLE,
67 RID_COMPLEX,
68 RID_RESTRICT,
70 RID_LAST_MODIFIER = RID_RESTRICT,
71 /* This is where grokdeclarator ends its search when setting the
72 specbits. */
74 RID_PUBLIC,
75 RID_PRIVATE,
76 RID_PROTECTED,
77 RID_EXCEPTION,
78 RID_TEMPLATE,
79 RID_NULL,
80 /* Before adding enough to get up to 64, the RIDBIT_* macros
81 will have to be changed a little. */
82 RID_MAX
85 /* The type that can represent all values of RIDBIT. */
86 /* We assume that we can stick in at least 32 bits into this. */
87 typedef struct { unsigned long idata[2]; }
88 RID_BIT_TYPE;
90 /* Be careful, all these modify N twice. */
91 #define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32)) \
92 & (V).idata[(N)/32])
93 #define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV))
94 #define RIDBIT_SET(N, V) do { \
95 (V).idata[(N)/32] \
96 |= ((unsigned long)1 << (int) ((N)%32)); \
97 } while (0)
98 #define RIDBIT_RESET(N, V) do { \
99 (V).idata[(N)/32] \
100 &= ~((unsigned long)1 << (int) ((N)%32)); \
101 } while (0)
102 #define RIDBIT_RESET_ALL(V) do { \
103 (V).idata[0] = 0; \
104 (V).idata[1] = 0; \
105 } while (0)
106 #define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
108 /* The elements of `ridpointers' are identifier nodes
109 for the reserved type names and storage classes.
110 It is indexed by a RID_... value. */
111 extern tree ridpointers[(int) RID_MAX];
113 /* the declaration found for the last IDENTIFIER token read in.
114 yylex must look this up to detect typedefs, which get token type TYPENAME,
115 so it is left around in case the identifier is not a typedef but is
116 used in a context which makes it a reference to a variable. */
117 extern tree lastiddecl;
119 extern char *token_buffer; /* Pointer to token buffer. */
121 /* Back-door communication channel to the lexer. */
122 extern int looking_for_typename;
123 extern int looking_for_template;
125 /* Tell the lexer where to look for names. */
126 extern tree got_scope;
127 extern tree got_object;
129 /* Pending language change.
130 Positive is push count, negative is pop count. */
131 extern int pending_lang_change;
133 extern int yylex PROTO((void));
135 extern struct lang_decl *free_lang_decl_chain;