bison-patches
[Top][All Lists]
Advanced

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

Re: FYI: line nums in C++


From: Akim Demaille
Subject: Re: FYI: line nums in C++
Date: Fri, 21 Feb 2003 09:29:54 +0100
User-agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.2

 Akim> Very true, thanks for the emphasis!  I'll follow your
 Akim> suggestion.

Index: ChangeLog
from   2003-02-21  Akim Demaille  <address@hidden>

        * data/lalr1.cc: Use temporary variables instead of casts to
        change integer types.
        Suggested by Paul Eggert.

Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.27
diff -u -u -r1.27 lalr1.cc
--- data/lalr1.cc 20 Feb 2003 14:42:43 -0000 1.27
+++ data/lalr1.cc 21 Feb 2003 08:12:34 -0000
@@ -432,8 +432,9 @@
       // Short files will use "unsigned char" for line numbers,
       // in which case they will be output as character litterals
       // by "<<".
+      unsigned yylineno = rline_[n_];
       YYCDEBUG << "Reducing via rule " << n_ - 1
-               << " (line " << static_cast <unsigned> (rline_[n_]) << "), ";
+               << " (line " << yylineno << "), ";
       for (]b4_int_type_for([b4_prhs])[ i = prhs_[n_];
           0 <= rhs_[i]; ++i)
        YYCDEBUG << name_[rhs_[i]] << ' ';
@@ -923,7 +924,9 @@
     /** \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;




reply via email to

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