[m-rev.] Improvements to pprint.m

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Apr 29 01:14:03 AEST 2001


On 26-Apr-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> Improve the pretty printer's output for various types.  This makes
> the debugger's pretty format much more useful.
> 
> library/pprint.m:
> 	Extended the pretty printer's to_doc/2 function to format
> 	lists, tuples and maps more readably.  Lists now appear
> 	as [a, b, c, ...], tuples as {a, b, c}, and maps as
> 	map(key1 -> value1, key2 -> value2, ...).  Ellipsis
> 	represents the remainder of a list of map where the depth
> 	limit has been reached.

This change broke the test case tests/debugger/browse_pretty.
So I've committed the following fix.

----------

Branches: main
Estimated hours taken: 0.4

tests/debugger/browse_pretty.exp:
	Update the expected output for this test case to match what is
	output after Ralph Beckett's recent change to library/pprint.m.

Workspace: /home/earth/fjh/ws-earth/mercury
Index: tests/debugger/browse_pretty.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/browse_pretty.exp,v
retrieving revision 1.4
diff -u -d -r1.4 browse_pretty.exp
--- tests/debugger/browse_pretty.exp	2001/02/23 04:15:16	1.4
+++ tests/debugger/browse_pretty.exp	2001/04/28 15:11:01
@@ -10,68 +10,35 @@
 browser> set depth 10
 browser> ls
 big(
-  big(big(small, .(1, []), small), .(1, .(2, [])), small), 
-  .(1, .(2, .(3, []))), 
+  big(big(small, [1], small), [1, 2], small), 
+  [1, 2, 3], 
   big(
-    big(
-      small, 
-      .(1, .(2, .(3, .(4, [])))), 
-      big(small, .(1, .(2, .(3, .(4, .(5, []))))), small)), 
-    .(1, .(2, .(3, .(4, .(5, .(6, [])))))), 
+    big(small, [1, 2, 3, 4], big(small, [1, 2, 3, 4, 5], small)), 
+    [1, 2, 3, 4, 5, 6], 
     small))
 browser> set width 131
 browser> ls
 big(
-  big(big(small, .(1, []), small), .(1, .(2, [])), small), 
-  .(1, .(2, .(3, []))), 
-  big(
-    big(small, .(1, .(2, .(3, .(4, [])))), big(small, .(1, .(2, .(3, .(4, .(5, []))))), small)), 
-    .(1, .(2, .(3, .(4, .(5, .(6, [])))))), 
-    small))
+  big(big(small, [1], small), [1, 2], small), 
+  [1, 2, 3], 
+  big(big(small, [1, 2, 3, 4], big(small, [1, 2, 3, 4, 5], small)), [1, 2, 3, 4, 5, 6], small))
 browser> set width 30
 browser> ls
 big(
   big(
-    big(
-      small, 
-      .(1, []), 
-      small), 
-    .(1, .(2, [])), 
+    big(small, [1], small), 
+    [1, 2], 
     small), 
-  .(1, .(2, .(3, []))), 
+  [1, 2, 3], 
   big(
     big(
       small, 
-      .(
-        1, 
-        .(
-          2, 
-          .(3, .(4, [])))), 
+      [1, 2, 3, 4], 
       big(
         small, 
-        .(
-          1, 
-          .(
-            2, 
-            .(
-              3, 
-              .(
-                4, 
-                .(
-                  5, 
-                  []))))), 
+        [1, 2, 3, 4, 5], 
         small)), 
-    .(
-      1, 
-      .(
-        2, 
-        .(
-          3, 
-          .(
-            4, 
-            .(
-              5, 
-              .(6, [])))))), 
+    [1, 2, 3, 4, 5, 6], 
     small))
 browser> set width 10
 browser> ls
@@ -79,70 +46,42 @@
   big(
     big(
       small, 
-      .(
-        1, 
-        []), 
+      [1], 
       small), 
-    .(
-      1, 
-      .(
-        2, 
-        [])), 
+    [1, 
+    2], 
     small), 
-  .(
-    1, 
-    .(
-      2, 
-      .(
-        3, 
-        []))), 
+  [1, 2, 
+  3], 
   big(
     big(
       small, 
-      .(
-        1, 
-        .(
-          2, 
-          .(
-            3, 
-            .(
-              4, 
-              [])))), 
+      [1, 
+      2, 
+      3, 
+      4], 
       big(
         small, 
-        .(
-          1, 
-          .(
-            2, 
-            .(
-              3, 
-              .(
-                4, 
-                .(
-                  5, 
-                  []))))), 
-        small)), 
-    .(
-      1, 
-      .(
+        [1, 
         2, 
-        .(
-          3, 
-          .(
-            4, 
-            .(
-              5, 
-              .(
-                6, 
-                [])))))), 
+        3, 
+        4, 
+        5], 
+        small)), 
+    [1, 
+    2, 
+    3, 
+    4, 
+    5, 
+    6], 
     small))
 browser> set width 79
 browser> set depth 3
 browser> ls
 big(
-  big(big(small, ./2, small), .(1, ./2), small), 
-  .(1, .(2, ./2)), 
-  big(big(small, ./2, big/3), .(1, ./2), small))
+  big(big(small, [...], small), [1, ...], small), 
+  [1, 2, ...], 
+  big(big(small, [...], big/3), [1, ...], small))
 browser> set format pretty
 browser> set lines 4
 browser> set width 40
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list