spyc
spyc copied to clipboard
{ } block split over several lines
sorry my english :ghost:
- 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
- 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, ), )
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.
in the symphony I noted a similar problem
@ryanuber: Any progress on this? Just got bitten by this today.
@ossobuffo I honestly have not done anything related to this project in some years now, sorry! Maybe @mustangostang has some ideas?