KenKundert / nestedtext_tests

5 stars 2 forks source link

Possibly incorrect test for dict tag in key #9

Closed RebelusQuo closed 2 years ago

RebelusQuo commented 2 years ago

From the official language reference:

The inline key precedes the tag. It must be a non-empty string and must not:

  1. contain a line break character.
  2. start with a list item, string item or key item tag,
  3. start with [ or {,
  4. contain a dictionary item tag, or
  5. contain leading spaces (any spaces that follow the key are ignored).

From the test fixture: dict_16/load_in.nt

key::

dict_16/load_out.json (simplified)

{"key:": ""}

To me this seems like a syntax error, correct?

RebelusQuo commented 2 years ago

Unless.. I shot from the hip too early. What exactly is a "dictionary item tag"? I might have been confused by the description in the "Line-type tags" section which speaks of a single :. is the rule it can't contain : or :\n (including a space or a newline, thus a two character sequence)?

erikw commented 2 years ago

See

Line-type tags:

Most remaining lines are identified by the presence of tags, where a tag is:

    the first dash (-), colon (:), or greater-than symbol (>) on a line when followed immediately by a space or line break;

https://nestedtext.org/en/stable/file_format.html

In this case there is no space or line break directly after the first :

RebelusQuo commented 2 years ago

@erikw Alright, so the root issue here is the potential of misunderstanding the earlier section. I'll suggest another wording in the parent repo.