home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / cp / lex.h < prev    next >
C/C++ Source or Header  |  1996-12-12  |  5KB  |  167 lines

  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).
  5.  
  6. This file is part of GNU CC.
  7.  
  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.
  14.  
  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.  */
  22.  
  23.  
  24.  
  25. enum rid
  26. {
  27.   RID_UNUSED,
  28.   RID_INT,
  29.   RID_BOOL,
  30.   RID_CHAR,
  31.   RID_WCHAR,
  32.   RID_FLOAT,
  33.   RID_DOUBLE,
  34.   RID_VOID,
  35.  
  36.   /* C++ extension */
  37.   RID_CLASS,
  38.   RID_RECORD,
  39.   RID_UNION,
  40.   RID_ENUM,
  41.   RID_LONGLONG,
  42.  
  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.  
  47.   RID_EXTERN,
  48.   RID_CONST,
  49.   RID_LONG,
  50.   RID_TYPEDEF,
  51.   RID_UNSIGNED,
  52.   RID_SHORT,
  53.   RID_INLINE,
  54.  
  55.   RID_STATIC,
  56.  
  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.  
  66. #ifdef NEXT_SEMANTICS
  67.   RID_DIRECT,    /* This is actually a storage class specifier. */
  68. #define RID_LAST_MODIFIER RID_DIRECT
  69. #endif
  70.  
  71. #if defined (_WIN32) && defined (NEXT_PDO)
  72.   RID_STDCALL,
  73.   RID_DECLSPEC,
  74.   RID_DLLIMPORT,
  75.   RID_DLLEXPORT,
  76. #if 0 /* These are not actually needed.  */
  77.   RID_THREAD,
  78.   RID_NAKED,
  79. #endif
  80. #define RID_LAST_MODIFIER RID_DLLEXPORT
  81. #endif
  82.  
  83. #ifdef OBJCPLUS
  84.   RID_IN,       /* begin Objective-C type modifiers */
  85.   RID_OUT,
  86.   RID_INOUT,
  87.   RID_BYCOPY,
  88.   RID_BYREF,
  89.   RID_ONEWAY,
  90.   RID_ID,       /* end Objective-C type modifiers */
  91. #undef RID_LAST_MODIFIER
  92. #define RID_LAST_MODIFIER RID_ID
  93. #endif
  94.  
  95.   /* This is where grokdeclarator ends its search when setting the specbits. */
  96.  
  97.   RID_PUBLIC,
  98.   RID_PRIVATE,
  99.   RID_PROTECTED,
  100.   RID_EXCEPTION,
  101.   RID_TEMPLATE,
  102.   RID_SIGNATURE,
  103.   /* Before adding enough to get up to 64, the RIDBIT_* macros
  104.      will have to be changed a little. */
  105.   RID_MAX
  106. };
  107.  
  108. #define NORID RID_UNUSED
  109.  
  110. #define RID_FIRST_MODIFIER RID_EXTERN
  111. #ifndef RID_LAST_MODIFIER
  112. #define RID_LAST_MODIFIER RID_MUTABLE
  113. #endif
  114.  
  115. /* The type that can represent all values of RIDBIT.  */
  116. /* We assume that we can stick in at least 32 bits into this. */
  117. typedef struct { unsigned long idata[2]; }
  118.      RID_BIT_TYPE;
  119.  
  120. /* Be careful, all these modify N twice. */
  121. #define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32))              \
  122.                 & (V).idata[(N)/32])
  123. #define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV))
  124. #define RIDBIT_SET(N, V) do {                              \
  125.                 (V).idata[(N)/32]                  \
  126.                   |= ((unsigned long)1 << (int) ((N)%32));    \
  127.                   } while (0)
  128. #define RIDBIT_RESET(N, V) do {                              \
  129.                   (V).idata[(N)/32]                  \
  130.                     &= ~((unsigned long)1 << (int) ((N)%32)); \
  131.                 } while (0)
  132. #define RIDBIT_RESET_ALL(V) do {                          \
  133.                    (V).idata[0] = 0;                   \
  134.                    (V).idata[1] = 0;                  \
  135.                  } while (0)
  136. #define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
  137.  
  138. /* The elements of `ridpointers' are identifier nodes
  139.    for the reserved type names and storage classes.
  140.    It is indexed by a RID_... value.  */
  141. extern tree ridpointers[(int) RID_MAX];
  142.  
  143. /* the declaration found for the last IDENTIFIER token read in.
  144.    yylex must look this up to detect typedefs, which get token type TYPENAME,
  145.    so it is left around in case the identifier is not a typedef but is
  146.    used in a context which makes it a reference to a variable.  */
  147. extern tree lastiddecl;
  148.  
  149. extern char *token_buffer;    /* Pointer to token buffer.  */
  150.  
  151. /* Back-door communication channel to the lexer.  */
  152. extern int looking_for_typename;
  153. extern int looking_for_template;
  154.  
  155. /* Tell the lexer where to look for names.  */
  156. extern tree got_scope;
  157. extern tree got_object;
  158.  
  159. /* Pending language change.
  160.    Positive is push count, negative is pop count.  */
  161. extern int pending_lang_change;
  162.  
  163. extern tree make_pointer_declarator (), make_reference_declarator ();
  164. extern void reinit_parse_for_function ();
  165. extern void reinit_parse_for_method ();
  166. extern int yylex ();
  167.