]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
portability: fix pointer arithmetic to conform to C standard.
[bison.git] / data / lalr1.cc
index 6c66dd1bd676f94f6a6cd091586d6ebb33c39d4c..183ddcd94be3c9e7ebab5cd584d3245cae7e8d67 100644 (file)
@@ -538,7 +538,7 @@ do {                                        \
     /// Location of the lookahead.
     location_type yylloc;
     /// The locations where the error started and ended.
-    location_type yyerror_range[2];
+    location_type yyerror_range[3];
 
     /// $$.
     semantic_type yyval;
@@ -709,7 +709,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
 b4_error_verbose_if([, yytoken])[));
       }
 
-    yyerror_range[0] = yylloc;
+    yyerror_range[1] = yylloc;
     if (yyerrstatus_ == 3)
       {
        /* If just tried and failed to reuse lookahead token after an
@@ -744,7 +744,7 @@ b4_error_verbose_if([, yytoken])[));
     if (false)
       goto yyerrorlab;
 
-    yyerror_range[0] = yylocation_stack_[yylen - 1];
+    yyerror_range[1] = yylocation_stack_[yylen - 1];
     /* Do not reclaim the symbols of the rule which action triggered
        this YYERROR.  */
     yypop_ (yylen);
@@ -776,7 +776,7 @@ b4_error_verbose_if([, yytoken])[));
        if (yystate_stack_.height () == 1)
        YYABORT;
 
-       yyerror_range[0] = yylocation_stack_[0];
+       yyerror_range[1] = yylocation_stack_[0];
        yydestruct_ ("Error: popping",
                     yystos_[yystate],
                     &yysemantic_stack_[0], &yylocation_stack_[0]);
@@ -785,10 +785,10 @@ b4_error_verbose_if([, yytoken])[));
        YY_STACK_PRINT ();
       }
 
-    yyerror_range[1] = yylloc;
+    yyerror_range[2] = yylloc;
     // Using YYLLOC is tempting, but would change the location of
     // the lookahead.  YYLOC is available though.
-    YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
+    YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
     yysemantic_stack_.push (yylval);
     yylocation_stack_.push (yyloc);