-
Notifications
You must be signed in to change notification settings - Fork 872
Description
The v1.0.0-rc.1 spec says, regarding multi-line strings:
When the last non-whitespace character on a line is a
\
, it will be trimmed along with all whitespace (including newlines) up to the next non-whitespace character or closing delimiter. All of the escape sequences that are valid for basic strings are also valid for multi-line basic strings.
This is unclear for the case when that last \
is escaped. I think the ABNF is correct and when I tested with tomlkit it looks good:
>>> from tomlkit import parse
>>> parse(r'''
... ml-escaped-nl = """
... foo \
... bar \\
... baz \\\
... quux"""''')
{'ml-escaped-nl': ' foo bar \\ \n baz \\quux'}
But I think the description in the spec can be clearer. I propose the following 1-word change (or 2 if you include the epenthesis of the preceding "a" to "an"):
- ending backslash". When the last non-whitespace character on a line is a `\`, it
+ ending backslash". When the last non-whitespace character on a line is an unescaped `\`, it
The code snippet above might also be a good test case.
Aside: Is https://github.com/BurntSushi/toml-test the de jure, or even de facto, test set? It hasn't been updated in a while.