// Short files will use "unsigned char" for line numbers,
// in which case they will be output as character litterals
// by "<<".
+ unsigned yylno = rline_[n_];
YYCDEBUG << "Reducing via rule " << n_ - 1
- << " (line " << static_cast <unsigned> (rline_[n_]) << "), ";
+ << " (line " << yylno << "), ";
for (]b4_int_type_for([b4_prhs])[ i = prhs_[n_];
0 <= rhs_[i]; ++i)
YYCDEBUG << name_[rhs_[i]] << ' ';
message += name_[ilooka_];
{
int count = 0;
- for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x)
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int xbegin = n_ < 0 ? -n_ : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int checklim = last_ - n_;
+ int xend = checklim < ntokens_ ? checklim : ntokens_;
+ for (int x = xbegin; x < xend; ++x)
if (check_[x + n_] == x && x != terror_)
++count;
if (count < 5)
{
count = 0;
- for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x)
+ for (int x = xbegin; x < xend; ++x)
if (check_[x + n_] == x && x != terror_)
{
message += (!count++) ? ", expecting " : " or ";
/** \brief (column related) Advance to the COLUMNS next columns. */
inline void columns (int columns = 1)
{
- if (int (initial_column) < columns + int (column))
+ int leftmost = initial_column;
+ int current = column;
+ if (leftmost <= current + columns)
column += columns;
else
column = initial_column;