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

Diff of /bison/data/yacc.c

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

revision 1.27 by akim, Thu Oct 24 11:40:27 2002 UTC revision 1.28 by akim, Sun Nov 3 16:41:57 2002 UTC
# Line 33  m4_define_default([b4_stack_depth_init], Line 33  m4_define_default([b4_stack_depth_init],
33  # Location type.  # Location type.
34  m4_define_default([b4_location_type], [yyltype])  m4_define_default([b4_location_type], [yyltype])
35    
36    
37    ## ------------------------ ##
38    ## Pure/impure interfaces.  ##
39    ## ------------------------ ##
40    
41    
42    # b4_Pure_if(IF-TRUE, IF-FALSE)
43    # -----------------------------
44    # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
45    m4_define([b4_Pure_if],
46    [b4_pure_if([m4_ifset([b4_parse_param],
47                          [$1], [$2])],
48                [$2])])
49    
50    
51    # b4_pure_args
52    # ------------
53    # Arguments passed to yyerror: user args plus yylloc.
54    m4_define([b4_pure_args],
55    [b4_Pure_if([b4_location_if([, &yylloc])])[]b4_user_args])
56    
57    
58    # b4_lex_param
59    # ------------
60  # Accumule in b4_lex_param all the yylex arguments.  # Accumule in b4_lex_param all the yylex arguments.
61  # Yes, this is quite ugly...  # b4_lex_param arrives quoted twice, but we want to keep only one level.
62  m4_define([b4_lex_param],  m4_define([b4_lex_param],
63  m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl  m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
64  b4_location_if([, [[YYLTYPE *], [&yylloc]]])])dnl  b4_location_if([, [[YYLTYPE *], [&yylloc]]])])dnl
65  m4_ifdef([b4_lex_param], [, ]b4_lex_param)))  m4_ifdef([b4_lex_param], [, ]b4_lex_param)))
66    
 # Yes, this is quite ugly...  
 m4_define_default([b4_parse_param])  
 m4_ifdef([b4_parse_param],  
 [m4_define([b4_parse_param],  
            b4_parse_param)])  
   
67    
68    
69  ## ------------ ##  ## ------------ ##
# Line 56  m4_ifdef([b4_parse_param], Line 74  m4_ifdef([b4_parse_param],
74  # ---------------------  # ---------------------
75  # Return the smallest int type able to handle numbers ranging from  # Return the smallest int type able to handle numbers ranging from
76  # MIN to MAX (included).  We overwrite the version from c.m4 which relies  # MIN to MAX (included).  We overwrite the version from c.m4 which relies
77  # on `signed char' which is not portable to old K&R compilers.  # on "signed char" which is not portable to old K&R compilers.
78  m4_define([b4_int_type],  m4_define([b4_int_type],
79  [m4_if(b4_ints_in($@,      [0],   [255]), [1], [unsigned char],  [m4_if(b4_ints_in($@,      [0],   [255]), [1], [unsigned char],
80         b4_ints_in($@,   [-128],   [127]), [1], [yysigned_char],         b4_ints_in($@,   [-128],   [127]), [1], [yysigned_char],
# Line 178  b4_copyright([Skeleton parser for Yacc-l Line 196  b4_copyright([Skeleton parser for Yacc-l
196     define necessary library symbols; they are noted "INFRINGES ON     define necessary library symbols; they are noted "INFRINGES ON
197     USER NAME SPACE" below.  */     USER NAME SPACE" below.  */
198    
199  /* Identify Bison output.  */  b4_identification
 #define YYBISON 1  
   
 /* Pure parsers.  */  
 #define YYPURE  b4_pure  
   
 /* Using locations.  */  
 #define YYLSP_NEEDED b4_locations_flag  
   
200  m4_if(b4_prefix[], [yy], [],  m4_if(b4_prefix[], [yy], [],
201  [/* If NAME_PREFIX is specified substitute the variables and functions  [/* If NAME_PREFIX is specified substitute the variables and functions
202     names.  */     names.  */
# Line 519  do                                                             \ Line 529  do                                                             \
529      }                                                           \      }                                                           \
530    else                                                          \    else                                                          \
531      {                                                           \      {                                                           \
532        yyerror ("syntax error: cannot back up");                 \        yyerror ("syntax error: cannot back up"b4_pure_args);     \
533        YYERROR;                                                  \        YYERROR;                                                  \
534      }                                                           \      }                                                           \
535  while (0)  while (0)
# Line 1125  yyerrlab: Line 1135  yyerrlab:
1135                          yycount++;                          yycount++;
1136                        }                        }
1137                  }                  }
1138                yyerror (yymsg);                yyerror (yymsg]b4_pure_args[);
1139                YYSTACK_FREE (yymsg);                YYSTACK_FREE (yymsg);
1140              }              }
1141            else            else
1142              yyerror ("parse error; also virtual memory exhausted");              yyerror ("parse error; also virtual memory exhausted"]b4_pure_args[);
1143          }          }
1144        else        else
1145  #endif /* YYERROR_VERBOSE */  #endif /* YYERROR_VERBOSE */
1146          yyerror ("parse error");          yyerror ("parse error"]b4_pure_args[);
1147      }      }
1148    goto yyerrlab1;    goto yyerrlab1;
1149    
# Line 1248  yyabortlab: Line 1258  yyabortlab:
1258  | yyoverflowlab -- parser overflow comes here.  |  | yyoverflowlab -- parser overflow comes here.  |
1259  `----------------------------------------------*/  `----------------------------------------------*/
1260  yyoverflowlab:  yyoverflowlab:
1261    yyerror ("parser stack overflow");    yyerror ("parser stack overflow"]b4_pure_args[);
1262    yyresult = 2;    yyresult = 2;
1263    /* Fall through.  */    /* Fall through.  */
1264  #endif  #endif

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

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