/[bison]/bison/data/bison.c++
ViewVC logotype

Diff of /bison/data/bison.c++

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by akim, Wed Mar 20 09:35:27 2002 UTC revision 1.19 by akim, Sun Apr 7 17:44:59 2002 UTC
# Line 1  Line 1 
1  m4_divert(-1)  m4_divert(-1)
2    
3    # b4_sint_type(MAX)
4    # -----------------
5    # Return the smallest signed int type able to handle the number MAX.
6    m4_define([b4_sint_type],
7    [m4_if(m4_eval([$1 <= 127]),        [1], [signed char],
8           m4_eval([$1 <= 32767]),      [1], [signed short],
9           m4_eval([$1 <= 2147483647]), [1], [signed int],
10           [m4_fatal([no signed int type for $1])])])
11    
12    
13    # b4_uint_type(MAX)
14    # -----------------
15    # Return the smallest unsigned int type able to handle the number MAX.
16    m4_define([b4_uint_type],
17    [m4_if(m4_eval([$1 <= 255]),        [1], [unsigned char],
18           m4_eval([$1 <= 65535]),      [1], [unsigned short],
19           m4_eval([$1 <= 4294967295]), [1], [unsigned int],
20           [m4_fatal([no unsigned int type for $1])])])
21    
22    
23  # b4_token_defines(TOKEN-NAME, TOKEN-NUMBER)  # b4_token_defines(TOKEN-NAME, TOKEN-NUMBER)
24  # ------------------------------------------  # ------------------------------------------
25  # Output the definition of this token as #define.  # Output the definition of this token as #define.
# Line 147  namespace yy Line 167  namespace yy
167    template < >    template < >
168    struct Traits< b4_name >    struct Traits< b4_name >
169    {    {
170        typedef typedef b4_uint_type(b4_token_number_max) TokenNumberType;
171      typedef int      StateType;      typedef int      StateType;
172      typedef yystype  SemanticType;      typedef yystype  SemanticType;
173      typedef b4_ltype LocationType;      typedef b4_ltype LocationType;
# Line 159  namespace yy Line 180  namespace yy
180    {    {
181    public:    public:
182    
183      typedef Traits< b4_name >::StateType    StateType;      typedef Traits< b4_name >::TokenNumberType TokenNumberType;
184      typedef Traits< b4_name >::SemanticType SemanticType;      typedef Traits< b4_name >::StateType       StateType;
185      typedef Traits< b4_name >::LocationType LocationType;      typedef Traits< b4_name >::SemanticType     SemanticType;
186        typedef Traits< b4_name >::LocationType    LocationType;
187    
188      typedef Stack< StateType >    StateStack;      typedef Stack< StateType >    StateStack;
189      typedef Stack< SemanticType > SemanticStack;      typedef Stack< SemanticType > SemanticStack;
# Line 218  namespace yy Line 240  namespace yy
240  #endif  #endif
241    
242      /* Even more tables.  */      /* Even more tables.  */
243      static inline char translate_ (int token);      static inline TokenNumberType translate_ (int token);
244    
245      /* Constants.  */      /* Constants.  */
246      static const int eof_;      static const int eof_;
# Line 685  yy::b4_name::rline_[[]] = Line 707  yy::b4_name::rline_[[]] =
707  #endif  #endif
708    
709  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
710  char  TokenNumberType
711  yy::b4_name::translate_ (int token)  yy::b4_name::translate_ (int token)
712  {  {
713    static    static
714    const char    const TokenNumberType
715    translate_[[]] =    translate_[[]] =
716    {    {
717      b4_translate      b4_translate
718    };    };
719    return ((unsigned)(token) <= maxtok_ ? translate_[[token]] : nsym_);    return (unsigned)(token) <= maxtok_ ? translate_[[token]] : nsym_;
720  }  }
721    
722  const int yy::b4_name::eof_ = 0;  const int yy::b4_name::eof_ = 0;

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26