The ". $" notation (was: Re: how useful are collecting lists?) Alan Manuel Gloria (18 Mar 2013 01:26 UTC)
Re: The ". $" notation Shiro Kawai (18 Mar 2013 02:42 UTC)
Re: The ". $" notation Alan Manuel Gloria (18 Mar 2013 02:44 UTC)
Re: The ". $" notation Shiro Kawai (18 Mar 2013 04:45 UTC)
Re: The ". $" notation David A. Wheeler (18 Mar 2013 16:25 UTC)
Re: The ". $" notation Alan Manuel Gloria (19 Mar 2013 00:17 UTC)
Re: The ". $" notation David A. Wheeler (19 Mar 2013 03:28 UTC)
Re: The ". $" notation Alan Manuel Gloria (19 Mar 2013 05:52 UTC)
Re: The ". $" notation David A. Wheeler (19 Mar 2013 10:44 UTC)
Handling scomments after "." David A. Wheeler (19 Mar 2013 03:41 UTC)
Re: Handling scomments after "." David A. Wheeler (19 Mar 2013 04:12 UTC)

Handling scomments after "." David A. Wheeler 19 Mar 2013 03:41 UTC

In the process of fiddling with ". $" I've noticed that the grammar doesn't
handle scomments after "." at all.  For those just tuning in,
"scomments" are special comments (such as #|....|#), and they're normally handled
by other conventions in the productions.  But after "." is a special situation, and
they aren't handled there.  So we need to fix that.

I've tweaked the BNF grammar to add support for scomments after ".",
as noted below. It's getting ugly, especially for "rest";
it might make sense to pull this out as its own separate
production just for this case (!).  If we do that,
we might as well regularize head vs. rest.  So the changes below
are almost certainly not the last word... just a heads-up that we need
to tweak the rules to make them work cleanly.

--- David A. Wheeler

==============================================

head returns [Object v]
  : PERIOD /* Leading ".": escape following datum like an n-expression. */
      (hspace+ (scomment hspace*)*
        (pn=n_expr hspace* (scomment hspace)* (n_expr error)? {$v = list($pn.v);}
         | /*empty*/  {$v = list(".");} )
       | /*empty*/    {$v = list(".");} )
...

rest returns [Object v]
  : PERIOD /* Improper list */
      (hspace+  (scomment hspace*)*
        (pn=n_expr hspace* (scomment hspace+)* (n_expr error)? {$v = $pn.v;}
         | COLLECTING hspace* pc=collecting_tail hspace*
           (scomment hspace+)* (n_expr error)? {$v = $pc.v;}
         | SUBLIST hspace* ps=rest {$v = $ps.v;}
         | /*empty*/ {$v = list(".");})
       | /*empty*/   {$v = list(".");})