Subject: | bug (+ patch) on nested inline collections with extra blanks |
This bug was discovered from a message on YAML-core mailing list.
http://sourceforge.net/mailarchive/forum.php?thread_id=7357346&forum_id=1771
This solution has been sent there also.
The problem happens when an inline collection (map or sequence) is nested into another inline collection and extra blanks are left among closing brackets. These emit errors:
--- { a: {k: v} } => YAML_PARSE_ERR_INLINE_MAP
--- { a: [1] } => YAML_PARSE_ERR_INLINE_MAP
--- [ {k: v} ] => YAML_PARSE_ERR_INLINE_SEQUENCE
--- [ [1] ] => YAML_PARSE_ERR_INLINE_SEQUENCE
But slight variations pass through. We could either use a trailing comma
--- { a: {k: v}, }
--- { a: [1], }
--- [ {k: v}, ]
--- [ [1], ]
or chop the blank
--- { a: {k: v}}
--- { a: [1]}
--- [ {k: v}]
--- [ [1]]
The fix was too easy. Four lines changed at YAML.pm where '\s*' was added to assure blanks before the closing bracket were allowed.
A complete patch based on "YAML-0.39.tar.gz" from CPAN is being submitted.
WHAT CHANGED
* lib/YAML.pm (4 lines)
* t/23inline.t (added)
(a script to test the fix worked and didn't break anything else)
* Changes
* MANIFEST (added t/23inline.t)
The update of the version number in lib/YAML.pm is missing. I didn't mean to offend you by touching the files 'Changes' and 'MANIFEST' but just to be more complete.
Regards,
Adriano R. Ferreira.
Message body not shown because it is not plain text.