OSDN Git Service

2001-07-30 H.J. Lu (hjl@gnu.org)
[pf3gnuchains/gcc-fork.git] / gcc / cp / lex.h
1 /* Define constants and variables for communication with parse.y.
2    Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3    2000 Free Software Foundation, Inc.
4    Hacked by Michael Tiemann (tiemann@cygnus.com)
5    and by Brendan Kehoe (brendan@cygnus.com).
6
7 This file is part of GNU CC.
8
9 GNU CC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY.  No author or distributor
11 accepts responsibility to anyone for the consequences of using it
12 or for whether it serves any particular purpose or works at all,
13 unless he says so in writing.  Refer to the GNU CC General Public
14 License for full details.
15
16 Everyone is granted permission to copy, modify and redistribute
17 GNU CC, but only under the conditions described in the
18 GNU CC General Public License.   A copy of this license is
19 supposed to have been given to you along with GNU CC so you
20 can know your rights and responsibilities.  It should be in a
21 file named COPYING.  Among other things, the copyright notice
22 and this notice must be preserved on all copies.  */
23
24 #ifndef GCC_CP_LEX_H
25 #define GCC_CP_LEX_H
26
27 #if 0
28 /* Formerly, the RID_* values used as mask bits did not fit into a
29    single 32-bit word.  Now they do, but let's preserve the old logic
30    in case they ever stop fitting again.  -zw, 8 Aug 2000 */
31
32 /* The type that can represent all values of RIDBIT.  */
33 /* We assume that we can stick in at least 32 bits into this.  */
34 typedef struct { unsigned long idata[2]; }
35      RID_BIT_TYPE;
36
37 /* Be careful, all these modify N twice.  */
38 #define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32))               \
39                             & (V).idata[(N)/32])
40 #define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV))
41 #define RIDBIT_SET(N, V) do {                                                 \
42                                 (V).idata[(N)/32]                             \
43                                   |= ((unsigned long)1 << (int) ((N)%32));    \
44                               } while (0)
45 #define RIDBIT_RESET(N, V) do {                                               \
46                                   (V).idata[(N)/32]                           \
47                                     &= ~((unsigned long)1 << (int) ((N)%32)); \
48                                 } while (0)
49 #define RIDBIT_RESET_ALL(V) do {                                              \
50                                    (V).idata[0] = 0;                          \
51                                    (V).idata[1] = 0;                          \
52                                  } while (0)
53 #define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
54 #else
55 typedef unsigned long RID_BIT_TYPE;     /* assumed at least 32 bits */
56 #define RIDBIT_OF(R) ((unsigned long)1 << (int) (R))
57
58 #define RIDBIT_SETP(N, V) ((V) & RIDBIT_OF (N))
59 #define RIDBIT_NOTSETP(N, V) (! ((V) & RIDBIT_OF (N)))
60 #define RIDBIT_ANY_SET(V) (V)
61
62 #define RIDBIT_SET(N, V) do { (V) |= RIDBIT_OF (N); } while (0)
63 #define RIDBIT_RESET(N, V) do { (V) &= ~RIDBIT_OF (N); } while (0)
64 #define RIDBIT_RESET_ALL(V) do { (V) = 0; } while (0)
65 #endif
66
67 /* the declaration found for the last IDENTIFIER token read in.
68    yylex must look this up to detect typedefs, which get token type TYPENAME,
69    so it is left around in case the identifier is not a typedef but is
70    used in a context which makes it a reference to a variable.  */
71 extern tree lastiddecl;
72
73 /* Back-door communication channel to the lexer.  */
74 extern int looking_for_typename;
75 extern int looking_for_template;
76
77 /* Tell the lexer where to look for names.  */
78 extern tree got_scope;
79 extern tree got_object;
80
81 /* Pending language change.
82    Positive is push count, negative is pop count.  */
83 extern int pending_lang_change;
84
85 extern int yylex PARAMS ((void));
86
87 #endif /* ! GCC_CP_LEX_H */