I think I've improved special comment handling. The previous BNF could handle special "comment" markers like "#!sweet", but you couldn't have blank lines after them.
The reason was that once we see "#", we need to invoke the it-expression machinery to process it, because "#" can introduce all sorts of constructs (vectors with #(), etc.). But once we invoke it-expression processing, the it-expression machinery has to produce *something*. That production doesn't really have a "produce nothing" case. Our current Scheme implementation uses special cons cells to indicate things like this, but it'd be much cleaner if we didn't need those kinds of hacks. I think instead we should modify the it_expr production so that if it sees "#!sweet" etc. all by itself on a line, it just keeps reading empty lines until it finds something. That way, we don't have a special case... it_expr eventually finds something to return. My approach disables initial-indentation processing for the next expression, but I don't think that's a problem. This means that in i_expr, in the case of: | (GROUP_SPLICE | scomment) hspace* /* Initial; Interpet as group */ (group_i=it_expr {$v = $group_i.v;} /* Ignore initial GROUP/scomment */ | comment_eol (indent g_body=body {$v = $g_body.v;} /* Normal GROUP use */ .... We just change: | same g_i=it_expr {$v = $g_i.v;} /* Plausible separator */ into this, adding "(comment_eol same)*" : | same (comment_eol same)* g_i=it_expr {$v = $g_i.v;} That should make sweet-expressions easier to use. A side effect is that an initial "\\" on a line, with nothing after it, will consume blank lines that follow. But you can't use "\\" in the middle of an expression to consume arbitrary blank lines; once you indent, a blank line still generates dedents which end the expression. It would be very difficult to do otherwise, as far as I can tell, without major surgery and the loss of other capabilities (esp. ease-of-use at the UI). So this represents a small tweak so that stuff like #!special-stuff can be handled, and not a significant change in how sweet-expressions are used. --- David A. Wheeler ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 _______________________________________________ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss