/[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.43 by eggert, Fri Dec 13 09:33:23 2002 UTC revision 1.44 by eggert, Sun Dec 15 09:20:24 2002 UTC
# Line 335  union yyalloc Line 335  union yyalloc
335  #define YYMAXUTOK   ]b4_user_token_number_max[  #define YYMAXUTOK   ]b4_user_token_number_max[
336    
337  #define YYTRANSLATE(YYX)                                                \  #define YYTRANSLATE(YYX)                                                \
338    ((YYX <= 0) ? YYEOF :                                                 \    ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
    (unsigned)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)  
339    
340  /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */  /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
341  static const ]b4_int_type_for([b4_translate])[ yytranslate[] =  static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
# Line 462  static const ]b4_int_type_for([b4_stos]) Line 461  static const ]b4_int_type_for([b4_stos])
461  #endif  #endif
462    
463  #define yyerrok         (yyerrstatus = 0)  #define yyerrok         (yyerrstatus = 0)
464  #define yyclearin       (yytoken = YYEMPTY)  #define yyclearin       (yychar = YYEMPTY)
465  #define YYEMPTY         -2  #define YYEMPTY         (-2)
466  #define YYEOF           0  #define YYEOF           0
467    
468  #define YYACCEPT        goto yyacceptlab  #define YYACCEPT        goto yyacceptlab
# Line 480  static const ]b4_int_type_for([b4_stos]) Line 479  static const ]b4_int_type_for([b4_stos])
479    
480  #define YYBACKUP(Token, Value)                                  \  #define YYBACKUP(Token, Value)                                  \
481  do                                                              \  do                                                              \
482    if (yytoken == YYEMPTY && yylen == 1)                         \    if (yychar == YYEMPTY && yylen == 1)                          \
483      {                                                           \      {                                                           \
484        yychar = (Token);                                         \        yychar = (Token);                                         \
485        yylval = (Value);                                         \        yylval = (Value);                                         \
# Line 790  b4_c_function_def([yyparse], [int], b4_p Line 789  b4_c_function_def([yyparse], [int], b4_p
789    yystate = 0;    yystate = 0;
790    yyerrstatus = 0;    yyerrstatus = 0;
791    yynerrs = 0;    yynerrs = 0;
792    yychar = yytoken = YYEMPTY;           /* Cause a token to be read.  */    yychar = YYEMPTY;             /* Cause a token to be read.  */
793    
794    /* Initialize stack pointers.    /* Initialize stack pointers.
795       Waste one element of value and location stack       Waste one element of value and location stack
# Line 900  yybackup: Line 899  yybackup:
899    
900    /* Not known => get a lookahead token if don't already have one.  */    /* Not known => get a lookahead token if don't already have one.  */
901    
902    /* YYTOKEN is either YYEMPTY or YYEOF or a valid token.  */    /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
903    if (yytoken == YYEMPTY)    if (yychar == YYEMPTY)
904      {      {
905        YYDPRINTF ((stderr, "Reading a token: "));        YYDPRINTF ((stderr, "Reading a token: "));
906        yychar = YYLEX;        yychar = YYLEX;
       yytoken = YYTRANSLATE (yychar);  
907      }      }
908    
909    if (yytoken == YYEOF)    if (yychar <= YYEOF)
910      {      {
911          yychar = yytoken = YYEOF;
912        YYDPRINTF ((stderr, "Now at end of input.\n"));        YYDPRINTF ((stderr, "Now at end of input.\n"));
913      }      }
914    else    else
915      {      {
916          yytoken = YYTRANSLATE (yychar);
917        YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);        YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
918      }      }
919    
# Line 938  yybackup: Line 938  yybackup:
938    YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));    YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
939    
940    /* Discard the token being shifted unless it is eof.  */    /* Discard the token being shifted unless it is eof.  */
941    if (yytoken != YYEOF)    if (yychar != YYEOF)
942      yytoken = YYEMPTY;      yychar = YYEMPTY;
943    
944    *++yyvsp = yylval;    *++yyvsp = yylval;
945  ]b4_location_if([  *++yylsp = yylloc;])[  ]b4_location_if([  *++yylsp = yylloc;])[
# Line 1080  yyerrlab: Line 1080  yyerrlab:
1080           error, discard it.  */           error, discard it.  */
1081    
1082        /* Return failure if at end of input.  */        /* Return failure if at end of input.  */
1083        if (yytoken == YYEOF)        if (yychar == YYEOF)
1084          {          {
1085            /* Pop the error token.  */            /* Pop the error token.  */
1086            YYPOPSTACK;            YYPOPSTACK;
# Line 1096  yyerrlab: Line 1096  yyerrlab:
1096    
1097        YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);        YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1098        yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[);        yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[);
1099        yytoken = YYEMPTY;        yychar = YYEMPTY;
1100      }      }
1101    
1102    /* Else will try to reuse lookahead token after shifting the error    /* Else will try to reuse lookahead token after shifting the error

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

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