cbor-wg / edn-literal

Application-oriented literals for CBOR extended diagnostic notation
Other
0 stars 7 forks source link

Comments containing slashes ➔ end-of-line comments #8

Closed chrysn closed 11 months ago

chrysn commented 1 year ago

Given that the box has been opened to collect (E)DN feature requests here, there's one I'd like to propose: Allow slashes in comments.

Our current comments span from one / to the next, so while a comment like / see http://example.com for details / technically works, that is just because luckily there are not odd slashes in the URI. Some examples already contain weird workarounds that substitute slashes in the comment with weird lookalike characters, breaking copy-paste of the URI (/ See http:⁄⁄example.com⁄ /).

One way of achieving this is to count asterisks immediately following the first slash, and requiring (at least) the same number of asterisks before the trailing slash. Thus, / comment /, /* See http://example.com/ */ and /** You can wrap comments in /* slashes */ if needed **/ would all be single closed comments.

Noteworthy properties of this proposal:

cabo commented 1 year ago

You can always double any slash. Jim Schaad liked using backslashes :-)

Oh, and you just volunteered doing the ABNF for the matching asterisks... (The matching asterisks at the end are easy, as they are context free, but ignoring only up to n-1 asterisks and a slash inside the comment is interesting.)

cabo commented 1 year ago

I think we are more likely to add line-end comments (whether we start them with # and/or ; and/or even //, you can use as many slashes there as you like).

chrysn commented 1 year ago

Only if I can do the asterisk part with "regular" expressions instead of ABNF ;-)

More seriously: Introducing trailing comments would solve the issue almost just as well.

cabo commented 11 months ago

OK, so this is "almost solved" now by c4aff27