bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI] skeleton-c++-m4.patch


From: Robert Anisko
Subject: [FYI] skeleton-c++-m4.patch
Date: Wed, 6 Feb 2002 15:30:53 +0100 (CET)

Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.535
diff -r1.535 ChangeLog
0a1,5
> 2002-02-06  Robert Anisko  <address@hidden>
> 
>       * data/bison.c++: Adjust the parser code.  Fix some muscles that were
>       not expanded by m4.
> 
Index: data/bison.c++
===================================================================
RCS file: /cvsroot/bison/bison/data/bison.c++,v
retrieving revision 1.2
diff -r1.2 bison.c++
1c1
< #output "b4_output_prefix[]b4_output_infix[].hh"
---
> #output "b4_output_prefix[]b4_output_infix[]-class.hh"
8c8
<    Copyright (C) 2002 Free Software Foundation, Inc.
---
>    Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
31d30
< /* #include "parser.hh" */
33a33,37
> b4_prologue
> 
> // FIXME: This should be defined in traits, not here.
> typedef b4_stype yystype;
> 
46,48c50,52
<     typedef int       StateType;
<     typedef b4_stype  SemanticType;
<     typedef Location  LocationType;
---
>     typedef int      StateType;
>     typedef yystype  SemanticType;
>     typedef b4_ltype LocationType;
52,53d55
< b4_prologue
< 
60c62
<     typedef Traits< b4_name >::StateType StateType;
---
>     typedef Traits< b4_name >::StateType    StateType;
68c70,75
<     b4_name () : debug (1)
---
>     b4_name (bool debug) : debug_ (debug)
>     {
>       looka = empty_;
>     }
> 
>     virtual ~b4_name ()
70d76
<       looka = empty;
78,82c84,88
<     virtual
<     void
<     lex ()
<     {
<       looka = yylex (&value);
---
>     virtual 
>     void 
>     lex () 
>     { 
>       looka = yylex (&value, &location);
97d102
<     static const short line_[[]];
103c108
<     /* FIXME: These tables should not be printed when not in debug
---
>     /* FIXME: These tables should not be printed when not in debug 
113,114c118,120
<     static const int eof;
<     static const int empty;
---
>     static const int eof_;
>     static const int empty_;
>     static const int ntokens_;
119c125
<     int debug;
---
>     int debug_;
121c127
< 
---
>     
125c131
< 
---
>     
133c139,144
< #include "b4_output_prefix[]b4_output_infix.hh"
---
> #include "b4_output_prefix[]b4_output_infix-class.hh"
> 
> /* Enabling traces.  */
> #ifndef YYDEBUG
> # define YYDEBUG b4_debug
> #endif
136c147
< #if b4_debug
---
> #if YYDEBUG
143c154
<   if (debug)                                  \
---
>   if (debug_)                                 \
146,147c157,160
< /* Nonzero means print parse trace.  Since this is uninitialized, it
<    does not stop multiple parsers from coexisting.  */
---
> /* Nonzero means print parse trace. [The following comment makes no
>    sense to me.  Could someone clarify it?  --akim] Since this is
>    uninitialized, it does not stop multiple parsers from coexisting.
>    */
177a191
>   goto yybackup;
188c202
<   if (looka == empty)
---
>   if (looka == empty_)
197c211
<       looka = eof;
---
>       looka = eof_;
204,206c218,223
< #if b4_debug
<       YYFPRINTF (stderr, "Next token is %d (%s", looka, name_[[ilooka]]);
<       YYFPRINTF (stderr, ")\n");
---
> #if YYDEBUG
>       if (debug_)
>       {
>         YYFPRINTF (stderr, "Next token is %d (%s", looka, name_[[ilooka]]);
>         YYFPRINTF (stderr, ")\n");
>       }
228c245
< 
---
>   
237,238c254,255
<   if (looka != eof)
<     looka = empty;
---
>   if (looka != eof_)
>     looka = empty_;
249a267
>   goto yyreduce;
254,255c272,282
<   value = semantic_stack[[1 - len]];
<   location = location_stack[[1 - len]];
---
>   if (len)
>     {
>       value = semantic_stack[[1 - len]];
>       location = location_stack[[1 - len]];
>     }
>   else
>     { 
>       // FIXME: This is truly ugly.
>       value = semantic_stack[[0]];
>       location = location_stack[[0]];
>     }
257,258c284,285
< #if b4_debug
<   if (debug)
---
> #if YYDEBUG
>   if (debug_)
267c294
< 
---
>   
269a297
>     LocationType& yyloc (location);
270a299
>     LocationStack& yylsp (location_stack);
277c306
< 
---
>   
282,283c311,312
< #if b4_debug
<   if (debug)
---
> #if YYDEBUG
>   if (debug_)
286c315
<       for (StateStack::ConstIterator i = state_stack.begin ();
---
>       for (StateStack::ConstIterator i = state_stack.begin (); 
292c321
< 
---
>   
298c327
<   state = pgoto_[[n - b4_ntokens]] + state_stack[[0]];
---
>   state = pgoto_[[n - ntokens_]] + state_stack[[0]];
302c331
<     state = defgoto_[[n - b4_ntokens]];
---
>     state = defgoto_[[n - ntokens_]];
307,308c336
<   // FIXME: Need something like yyerror?
<   std::cerr << "Parse error." << std::endl;
---
>   std::cerr << "Parse error." << std::endl; // FIXME: Need something like 
> yyerror?
310c338
< 
---
>   
316c344
< /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
---
> /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
318c346
< const short
---
> const short 
324c352
< /* YYDEFACT[[S]] -- default rule to reduce with in state S when YYTABLE
---
> /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
327c355
< const short
---
> const short 
333,334c361,362
< /* YYPGOTO[[NTERM-NUM]].  */
< const short
---
> /* YYPGOTO[NTERM-NUM].  */
> const short 
340,341c368,369
< /* YYDEFGOTO[[NTERM-NUM]].  */
< const short
---
> /* YYDEFGOTO[NTERM-NUM].  */
> const short 
347c375
< /* YYTABLE[[YYPACT[STATE-NUM]]].  What to do in state STATE-NUM.  If
---
> /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
350c378
< const short
---
> const short 
357c385
< const short
---
> const short 
363c391
< /* YYRLINE[[YYN]] -- source line where rule number YYN was defined.  */
---
> /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
365c393
< yy::b4_name::line_[[]] =
---
> yy::b4_name::rline_[[]] =
367c395
<   b4_line
---
>   b4_rline
370,371c398,399
< /*YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives.  */
< const short
---
> /*YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
> const short 
377,378c405,406
< /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN.  */
< const short
---
> /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
> const short 
384c412
< /* YYTNAME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
---
> /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
393c421
< const short
---
> const short 
399c427
< /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
---
> /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
401c429
< const short
---
> const short 
407,413d434
< /* YYRLINE[[YYN]] -- Source line where rule number YYN was defined.  */
< const short
< yy::b4_name::rline_[[]] =
< {
<   b4_rline
< };
< 
418,419c439,440
<   static
<   const char
---
>   static 
>   const char 
427,428c448,450
< const int yy::b4_name::eof = 0;
< const int yy::b4_name::empty = -2;
---
> const int yy::b4_name::eof_ = 0;
> const int yy::b4_name::empty_ = -2;
> const int yy::b4_name::ntokens_ = b4_ntokens;
484c506
< 
---
>     
522a545,578
> 
> m4_if(b4_defines_flag, 0, [],
> [#output "b4_output_header_name"
> #ifndef b4_header_guard
> # define b4_header_guard
> 
> b4_tokendef
> 
> #ifndef YYSTYPE
> typedef b4_stype
> yystype;
> # define YYSTYPE yystype
> #endif
> 
> m4_if(b4_pure, [0],
> [extern YYSTYPE b4_prefix[]lval;])
> 
> m4_if(b4_locations_flag, [0], [],
> [#ifndef YYLTYPE
> typedef struct yyltype
> {
>   int first_line;
>   int first_column;
>   int last_line;
>   int last_column;
> } yyltype;
> # define YYLTYPE yyltype
> #endif
> 
> m4_if(b4_pure, [0],
> [extern YYLTYPE b4_prefix[]lloc;])
> ])
> #endif /* not b4_header_guard */
> ])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]