Per recent discussion, I've changed the BNF so that the sweet-expression BNF 
supports "$" at the end of the line, whether "$" begins a line or happens later.

With this change:
a $
! b c
; ==> (a ((b c)))

and also:
$
! ddd eee
; ==> (((ddd eee)))

Basically, "$" at the end of the line works the same way as "$ \\" at the end 
of the line.

If this looks right, I can do the same to the Scheme implementation.  Does 
everyone agree that this is the expected mapping?

This does NOT provide partial-dedent support, but it certainly moves towards it 
somewhat.  This change can be justified purely on the grounds of consistency, 
so I'm fine with this tweak.  If we DO implement partial-dedents, this would be 
the first step.

--- David A. Wheeler



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

--- a/sweet.g
+++ b/sweet.g
@@ -1110,8 +1110,9 @@ it_expr returns [Object v]
         //   comment_eol same more=it_expr {$v = append($head.v, $more.v);}
         comment_eol error
         | empty {$v = monify($head.v);} )
-     | SUBLIST hspace* sub_i=it_expr /* head SUBLIST it_expr case */
-       {$v=append($head.v, list($sub_i.v));}
+     | SUBLIST hspace* /* head SUBLIST ... case */
+       (sub_i=it_expr {$v=append($head.v, list($sub_i.v));}
+        | comment_eol indent sub_b=body {$v = append($head.v, list($sub_b.v));}
      | comment_eol // Normal case, handle child lines if any:
        (indent children=body {$v = append($head.v, $children.v);}
         | empty              {$v = monify($head.v);} /* No child lines */ )
@@ -1126,7 +1127,9 @@ it_expr returns [Object v]
                    /* Handle #!sweet EOL EOL t_expr */
                    | comment_eol restart=t_expr {$v = $restart.v;} )
           | dedent error ))
-  | SUBLIST hspace* is_i=it_expr {$v=list($is_i.v);} /* "$" first on line */
+  | SUBLIST hspace* /* "$" first on line */
+    (is_i=it_expr {$v=list($is_i.v);}
+     | comment_eol indent sub_body=body {$v = list($sub_body.v);} )
   | abbrevw hspace*
       (comment_eol indent ab=body
          {$v = append(list($abbrevw.v), $ab.v);}

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to