Skip to content

Commit

Permalink
Clarify white space policy for inline strings; added tests for policy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Feb 4, 2024
1 parent fb34fa1 commit ced1fed
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Latest development version
| Version: 3.6.1
| Released: 2024-01-26
- Clarified policy on white space in inline strings.


v3.6 (2023-05-30)
-----------------
Expand Down
14 changes: 10 additions & 4 deletions doc/file_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ The *NestedText* format follows a small number of simple rules. Here they are.
A bracket introduces an inline list and a brace introduces an inline
dictionary.

Inlines are confined to a single line, and so must not contain any
line-break white space, such as newlines.

An *inline list* starts with an open bracket (``[``), ends with a matching
closed bracket (``]``), contains inline values separated by commas (``,``),
and is contained on a single line. The values may be inline strings, inline
Expand All @@ -182,10 +185,13 @@ The *NestedText* format follows a small number of simple rules. Here they are.
lists. They are somewhat constrained in the characters that they may
contain; nothing is allowed that might be confused with the syntax
characters used by the inline list or dictionary that contains it.
Specifically, inline strings may not contain newlines or any of the
following characters: ``[``, ``]``, ``{``, ``}``, or ``,``. In addition,
inline strings that are contained in inline dictionaries may not contain
``:``. Both leading and trailing white space is ignored with inline strings.
Specifically, inline strings may not line-break white space such as newlines
or any of the following characters: ``[``, ``]``, ``{``, ``}``, or ``,``.
In addition, inline strings that are contained in inline dictionaries may
not contain ``:``. Both leading and trailing white space is ignored with
inline strings. This includes all non-line-break white space characters
such as ASCII spaces and tabs, as well as the various Unicode white space
characters.

Both inline lists and dictionaries may be empty, and represent the only way
to represent empty lists or empty dictionaries in *NestedText*. An empty
Expand Down
1 change: 1 addition & 0 deletions doc/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Latest development version
| Released: 2024-01-26
- Added *offset* option to :meth:`Location.as_line()`.
- Clarified policy on white space in inline strings.


v3.6 (2023-05-30)
Expand Down

0 comments on commit ced1fed

Please sign in to comment.