Yecht fails to parse nested YAML with split newlines
----------------------------------------------------
Key: JRUBY-4893
URL: http://jira.codehaus.org/browse/JRUBY-4893
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.5
Environment: Java 1.6.0_20-b-02, Windows Server 2003
Reporter: Colin Strasser
Assignee: Thomas E Enebo
Attachments: nested.yml
In JRuby 1.3 (JvYAML), the attached file parses as expected:
{code:title=JRuby 1.3 parsing nested YAML}
irb(main):032:0> y = YAML::parse_file("C:\\nested.yml")
=> #<YAML::JvYAML::Scalar:0x1286b10 @value="--- \n- \n x: v1\n y: v2\n",
@kind=:scalar, @style="\"
", @type_id="tag:yaml.org,2002:str">
irb(main):033:0> py = YAML::parse(y.value)
=> #<YAML::JvYAML::Seq:0x41f227 @value=[#<YAML::JvYAML::Map:0x1e40274
@value={#<YAML::JvYAML::Scalar
:0x113e8f3 @value="y", @kind=:scalar, @style="\000",
@type_id="tag:yaml.org,2002:str">=>#<YAML::JvYA
ML::Scalar:0xbc312f @value="v2", @kind=:scalar, @style="\000",
@type_id="tag:yaml.org,2002:str">, #<
YAML::JvYAML::Scalar:0x5e9f1 @value="x", @kind=:scalar, @style="\000",
@type_id="tag:yaml.org,2002:s
tr">=>#<YAML::JvYAML::Scalar:0x14124d6 @value="v1", @kind=:scalar,
@style="\000", @type_id="tag:yaml
.org,2002:str">}, @kind=:map, @style=false, @type_id="tag:yaml.org,2002:map">],
@kind=:seq, @style=f
alse, @type_id="tag:yaml.org,2002:seq">
irb(main):034:0> py.display
---
- y: v2
x: v1
=> nil
irb(main):035:0>
{code}
But in JRuby 1.5 (probably 1.4+) using Yecht, the same file yields an error:
{code:title=JRuby 1.5 using Yecht can't parse the contents of the file}
>> y = YAML::parse_file("C:\\nested.yml")
=> #<YAML::Yecht::Scalar:0xb38dba @style=:quote2, @kind=:scalar, @value="---
\n- \n\\ x: v1\n y: v
2\n", @type_id="tag:yaml.org,2002:str">
>> py = YAML::parse(y.value)
ArgumentError: syntax error on line 2, col 4: `\ x: v1'
from yaml:177:in `parse'
from (irb):23
>>
{code}
I distilled the file from actual output of the yaml_db library. I was trying to
export data from a SQLite3 table, one column of which was YAML text. It appears
that some newlines (\n) were split across two lines of the resulting YAML and
Yecht doesn't like that.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email