ion-docs icon indicating copy to clipboard operation
ion-docs copied to clipboard

Comments as Whitespace vs Stop Characters

Open rmarrowstone opened this issue 10 months ago • 0 comments

There is some ambiguity between the spoken-language spec and the Text Grammar about whether comment starts delimit the end of "numeric_entities" and "sexp_keyword_entities."

Consider the below:

2004T/* comment after Timestamp with no whitespace*/

Per the grammar, that should be legal as comments are included in ws.

top_level_value
    : annotation+ top_level_value
...
    | numeric_entity ws // timestamp is a "numeric_entity"
... 

ws
    : WHITESPACE
    | INLINE_COMMENT
    | BLOCK_COMMENT
    ;

But per the spoken-language spec, '/' is not a "stop-character."

In the text notation, timestamp values must be followed by one of the fifteen numeric stop-characters: {}[](),\"\'\ \t\n\r\v\f

This same ambiguity exists for integers, real numbers and keywords.

The ion CLI considers following any of the above a parse error. I have not canvassed other implementations.

rmarrowstone avatar May 02 '24 00:05 rmarrowstone