karupanerura / TOML-Parser

simple toml parser
Other
15 stars 6 forks source link

All whitespace at the beginning of multi-line strings gets stripped #14

Closed pvgoran closed 7 years ago

pvgoran commented 7 years ago

I'm using TOML-0.97 with TOML::Parser-0.10.

The following code:

use TOML;
my $ref = from_toml "val = \'\'\'\n    \n    SPACES1\n    SPACES2\n\'\'\'";
print $ref->{val};

produces:

SPACES1
    SPACES2

This is wrong: according to the specification, only the first line break must be skipped when parsing multi-line strings, all other whitespace must remain intact. So the output should include four spaces at the beginning.

This problem occurs with both normal multi-line strings and literal multi-line strings.