fpTOML icon indicating copy to clipboard operation
fpTOML copied to clipboard

The last line has to be closed by a newline, which should not be necessary according to TOML specification

Open nussbaumer-planb opened this issue 1 year ago • 0 comments

Problem: Pasing may fail if the last line of file is not finished with a newline (see as an example tests/pass/T6.toml). The TOML specification clarifies:

There must be a newline (or EOF) after a key/value pair.

Solution: Simply modify the definition of TScanner.IsLineEnding to include the EOF (#0) character: Result := (c in [TCharSetLineEnding]) or (c = #0); Note that this modification eventually may imply modifications at callers side.

EDIT: my fault... the TOML specification v1.0.0 and v.1.0.0-rc differ in this point: the latter, which is claimed to be obeyed by fpTOML, does not state that EOF legally finishes a key/value pair. Feel free to close this issue without changes (though I think adding this may be useful).

nussbaumer-planb avatar Jul 05 '24 09:07 nussbaumer-planb