dezhidki / Tommy

A single-file TOML reader and writer for C#
MIT License
212 stars 16 forks source link

Unclosed strings don't throw TomlParseException #15

Closed 0xced closed 3 years ago

0xced commented 3 years ago

Sample code:

using var reader = new StringReader("items = [ 'first', 'second ]");
var table = TOML.Parse(reader);
foreach (var element in table["items"].Children.Select(e => e.AsString?.Value))
{
    Console.WriteLine($"<{element}>");
}

Notice the missing closing string (') after the second element.

Expected behavior: a TomlParseException is thrown.

Actual behavior: the toml string is parsed and the the following lines are printed on the console:

<first>
<second ]>

Note that parsing is also successful for simple key/value pairs with missing closing string: key = 'value. I think this input should also throw TomlParseException.