spyc icon indicating copy to clipboard operation
spyc copied to clipboard

{ } block split over several lines

Open interlab opened this issue 11 years ago • 4 comments

sorry my english :ghost:

  1. there shall be an error

example:

text: {
    test1: 123
    test2: 456
    test3: 789
}

out: array ( 'text' => array ( 'test1' => 123, 'test2' => 456, 'test3' => 789, ), 0 => '}', )

it was expected: error


  1. error

example:

text: {
    test1: 123,
    test2: 456,
    test3: 789
}

out: array ( 'text' => array ( 'test1' => '123,', 'test2' => '456,', 'test3' => 789, ), 0 => '}', )

it was expected: array ( 'text' => array ( 'test1' => 123, 'test3' => 789, 'test2' => 456, ), )

interlab avatar Nov 27 '13 12:11 interlab

This is probably because currently Spyc is mostly line-driven. If you load the inline block as a single line, seems to work fine, accounting for the { and } characters as well as the , delimiter between elements. The problem comes in when a block using { and } is split across multiple lines. It seems like Spyc then uses its traditional YAML format parser, hence the mistakes. I started working on a fix but quickly realized that the problem is larger than I initially thought.

The YAML syntax in question has been supported by the spec since YAML 1.0, so we really should fix this. I'll take another stab at it at some point if no one else jumps on it.

ryanuber avatar Nov 28 '13 20:11 ryanuber

in the symphony I noted a similar problem

interlab avatar Nov 29 '13 06:11 interlab

@ryanuber: Any progress on this? Just got bitten by this today.

ossobuffo avatar May 11 '16 20:05 ossobuffo

@ossobuffo I honestly have not done anything related to this project in some years now, sorry! Maybe @mustangostang has some ideas?

ryanuber avatar May 13 '16 23:05 ryanuber