Export to GitHub

spyc - issue #57

Incorrect parsing keys with "-" on start (-example: value)


Posted on Jan 2, 2013 by Grumpy Ox

What steps will reproduce the problem?

-example: value

What is the expected output? What do you see instead?

array([-example] => value)

What version of the product are you using? On what operating system?

spyc 0.5

debian, WXP, W7

Please provide any additional information below.

CAUTION, it's used too:

list_of_items: - -item - '-item' -item: value

to fix the problem, replace in functions:

in isArrayElement($line):

[line 915] if ($line[0] != '-') return false;

replace:

if ( (substr($line, 0,2) != '- ' && strlen($line)>1) || ($line != '-' && strlen($line)==1) ) return false;

in startsMappedSequence($line):

[line 942] return ($line[0] == '-' && substr ($line, -1, 1) == ':');

replace:

return (substr($line,0,2) == '- ' && substr ($line, -1, 1) == ':');

Check wiki [eng] for correct schema of lists. Regards Kai

Comment #1

Posted on Jan 11, 2013 by Happy Panda

Seems that it's fixed in latest Spyc version on github: https://github.com/mustangostang/spyc

Status: Fixed

Labels:
Type-Defect Priority-Medium