Dustin Voss | 15 Feb 04:03

Gwydion Dylan macro parsing error

Gwydion Dylan seems to have a bug in its macro processing, which I've  
logged as #7369. The problem is that final semicolons can't be omitted  
from a defining macro call. The bug includes a brief sample to  
demonstrate the problem, and Open Dylan doesn't have a problem.

I think I've fixed it, but I wanted to run it past the group before  
checking it in. The code had special logic for semicolon-separated  
fragment matching vs. comma-separated fragment matching, and there may  
have been a reason for that which I'm unaware of.

Anyway, since the comma-separated fragment matching code works as I  
expect from reading the DRM (p. 151-152, http://www.opendylan.org/books/drm/Patterns) 
, my proposed fix simply applies the same logic to both the semicolon-  
and comma-separated cases.

Here is the diff:

Index: d2c/compiler/parser/support.dylan
===================================================================
--- d2c/compiler/parser/support.dylan	(revision 11673)
+++ d2c/compiler/parser/support.dylan	(working copy)
@@ -425,33 +425,15 @@
  define generic remove-optional-semi-and-end (pattern :: <pattern>)
      => (new-pattern :: <pattern>, found-end? :: <boolean>);

-define method remove-optional-semi-and-end (pattern :: <semicolon- 
pattern>)
+define method remove-optional-semi-and-end
+    (pattern :: type-union(<semicolon-pattern>, <comma-pattern>))
      => (new-pattern :: <pattern>, found-end? :: <boolean>);
(Continue reading)


Gmane