Escape Sequences For Managing Whitespace (Preview)

Guy Steele guy.steele at oracle.com
Thu Aug 15 17:39:58 UTC 2019


> On Aug 15, 2019, at 11:19 AM, Jim Laskey <james.laskey at oracle.com> wrote:
> 
> Assuming the proposal is <LWS* \ LWS* LWS> (keep last white space), I see the light but I see the dark here as well (and maybe not enough here to switch horses.)
> 
> String hexData = """
>             000102030405060708090a0b0c0d0e0f101112131415   \
>     161718191a1b1c1d1e1f202122232425262728292a2b2c \
>     2d2e2f303132333435363738393a3b3c3d3e3f40       \
>     4142434445464748494a4b4c4d4e4f505152535455     \
>     """;
> 
> This sort of pattern is high maintenance; aligning backslashes.

A good IDE will help you align the backslashes.  EMACS C mode certainly does.  (Note how carefully I have finessed the question of whether EMACS actually constitutes a “good IDE”! :-)

But I note that this style of aligned backslashes is used in the C world only in situations where it really doesn’t matter how much whitespace there is where the line is broken.

This suggests the following tweak to John’s proposal: replace < LWS* \ LT LWS* LWS > and likewise < LWS LWS* \ LT LWS* > with a single space, and otherwise simply delete < \ LT >.

(If this isn’t what you want, then again, you can use \s to delimit what you want kept.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190815/7196423d/attachment.html>


More information about the amber-spec-experts mailing list