groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff ChangeLog src/preproc/pic/pic.y


From: Werner LEMBERG
Subject: [Groff-commit] groff ChangeLog src/preproc/pic/pic.y
Date: Tue, 16 Jun 2009 21:08:26 +0000

CVSROOT:        /cvsroot/groff
Module name:    groff
Changes by:     Werner LEMBERG <wl>     09/06/16 21:08:25

Modified files:
        .              : ChangeLog 
        src/preproc/pic: pic.y 

Log message:
        pic: Fix handling of nested positions.
        Reported by Doug McIlroy <address@hidden>.
        
        * src/preproc/pic/pic.y: Split `expr' into `expr_lower_than' and
        `expr_not_lower_than' so that we can handle
        
          (1/3)<(1/2)<foo,bar>,baz>
        
        correctly.  Without the patch, `(1/3)<(1/2)' is handled prematurely
        as a comparison.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.1204&r2=1.1205
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/pic/pic.y?cvsroot=groff&r1=1.25&r2=1.26

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.1204
retrieving revision 1.1205
diff -u -b -r1.1204 -r1.1205
--- ChangeLog   7 May 2009 16:22:16 -0000       1.1204
+++ ChangeLog   16 Jun 2009 21:08:25 -0000      1.1205
@@ -1,3 +1,16 @@
+2009-05-29  Werner LEMBERG  <address@hidden>
+
+       pic: Fix handling of nested positions.
+       Reported by Doug McIlroy <address@hidden>.
+
+       * src/preproc/pic/pic.y: Split `expr' into `expr_lower_than' and
+       `expr_not_lower_than' so that we can handle
+
+         (1/3)<(1/2)<foo,bar>,baz>
+
+       correctly.  Without the patch, `(1/3)<(1/2)' is handled prematurely
+       as a comparison.
+
 2009-05-07  Werner LEMBERG  <address@hidden>
 
        Accept \0 and friends within \o.

Index: src/preproc/pic/pic.y
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/pic/pic.y,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- src/preproc/pic/pic.y       5 Jan 2009 20:11:09 -0000       1.25
+++ src/preproc/pic/pic.y       16 Jun 2009 21:08:25 -0000      1.26
@@ -17,6 +17,7 @@
 
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
 %{
 #include "pic.h"
 #include "ptable.h"
@@ -61,6 +62,7 @@
 
 %}
 
+%expect 2
 
 %union {
        char *str;
@@ -253,7 +255,7 @@
 %right '!'
 %right '^'
 
-%type <x> expr any_expr text_expr
+%type <x> expr expr_lower_than expr_not_lower_than any_expr text_expr
 %type <by> optional_by
 %type <pair> expr_pair position_not_place
 %type <if_data> simple_if
@@ -1205,12 +1207,13 @@
                  $$.x = (1.0 - $2)*$4.x + $2*$6.x;
                  $$.y = (1.0 - $2)*$4.y + $2*$6.y;
                }
-       | expr '<' position ',' position '>'
+       /* the next two rules cause harmless shift/reduce warnings */
+       | expr_not_lower_than '<' position ',' position '>'
                {
                  $$.x = (1.0 - $1)*$3.x + $1*$5.x;
                  $$.y = (1.0 - $1)*$3.y + $1*$5.y;
                }
-       | '(' expr '<' position ',' position '>' ')'
+       | '(' expr_not_lower_than '<' position ',' position '>' ')'
                {
                  $$.x = (1.0 - $2)*$4.x + $2*$6.x;
                  $$.y = (1.0 - $2)*$4.y + $2*$6.y;
@@ -1481,6 +1484,18 @@
        ;
 
 expr:
+       expr_lower_than
+               { $$ = $1; }
+       | expr_not_lower_than
+               { $$ = $1; }
+       ;
+
+expr_lower_than:
+       expr '<' expr
+               { $$ = ($1 < $3); }
+       ;
+
+expr_not_lower_than:
        VARIABLE
                {
                  if (!lookup_variable($1, & $$)) {
@@ -1642,8 +1657,6 @@
                  $$ = 0;
                  srand((unsigned int)$3);
                }
-       | expr '<' expr
-               { $$ = ($1 < $3); }
        | expr LESSEQUAL expr
                { $$ = ($1 <= $3); }
        | expr '>' expr




reply via email to

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