<div dir="ltr">Consider the case where someone has done: let x = do ...<div><br></div><div>There's also the opposite edge case, which people doing one-liners in ghci or lambdabot run into fairly often: ... do ...; let x = 5; ...</div><div>Where the semicolon continues the let bindings, not the do; you must use braces to disambiguate.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 11, 2019 at 8:56 PM Chris Smith <<a href="mailto:cdsmith@gmail.com">cdsmith@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Quick question.  I'm trying to resolve Haskell layout in order to provide better syntax highlighting, but without committing to building a full Haskell parser.  The reason this is hard at face value is because of the "Note 5" in the relevant part of the Haskell Report, which says that a layout context closes whenever (a) the next token without closing the layout context would not be the start of any valid Haskell syntax, but (b) the current statement followed by an implicit '}' could be valid Haskell syntax.  This rule is why it's okay to write "let x = 5 in x^2", even though let introduces a new layout syntax: the "in" implicitly closes it because "x = 5 in" isn't the start of any valid syntax, so the layout context is implicitly closed before the "in".<br><div><br></div><div>Now for my question.  Does anyone know other cases besides let/in where this commonly comes up?  Everywhere I've seen this before uses let/in as an example, but then concludes that full parsing is needed and gives up on simpler answers.  But the specific example with let/in is easily handled with a special-purpose rule that closes layout contexts as needed when an "in" keyword shows up.  I cannot seem to construct any other examples, because other layout-introducing keywords have their contents at the end of syntactic element.</div><div><br></div><div>Is there something I've missed here?  I don't even care if it's a situation where something is technically valid but a horrible edge case.  I'm interested in realistic counterexamples.</div><div><br></div><div>Thanks,</div><div>Chris</div></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>brandon s allbery kf8nh</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a></div></div></div></div></div>