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)

Re: Handling scomments after "." David A. Wheeler 19 Mar 2013 04:12 UTC

Here's an updated BNF to deal with scomments after period.  I've ended up
adding a whole new production rule to deal with it.  This makes "head" and "rest"
consistent, it simplifies the other rules, and it'll also make the Scheme implementation easier too.

We need to do this whether or not we allow the ". $" sequence; we can remove "SUBLIST"
from the post_period production if we want to remove that.

Comments?  Any errors here?  If this seems okay, I'll change the Scheme implementation
to match, but I'd rather have the BNF right in the first place :-).

(The BNF below is in Java syntax; when it goes into the SRFI it'll get changed to Scheme syntax.)

--- David A. Wheeler

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

// Process line after ". hspace+" sequence.  Does not go past current line.
post_period returns [Object v]
  : (scomment hspace*)*
    // NOTE: The SUBLIST and empty branch (alternatives 3 and 4) are
    // technically ambiguous (SUBLIST is first, so it's resolved first).
    (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(".");} ) ;

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

rest returns [Object v]
  : PERIOD /* Improper list */
      (hspace+  pp=post_period {$v = $pp.v;}
       | /*empty*/   {$v = list(".");})
  | scomment hspace* (sr=rest {$v = $sr.v;} | /*empty*/ {$v = null;} )
...