Arturas Slajus created JRUBY-6375:
-------------------------------------
Summary: Uninformative YAML parser error
Key: JRUBY-6375
URL: https://jira.codehaus.org/browse/JRUBY-6375
Project: JRuby
Issue Type: Bug
Components: Ruby 1.9.2, Standard Library
Affects Versions: JRuby 1.6.5, JRuby 1.6.6
Reporter: Arturas Slajus
Assignee: Thomas E Enebo
Priority: Minor
When parsing bad YAML, parser gives very unclear message of what went wrong:
{noformat}
arturas@zeus:~/work$ cat yaml_test.rb
#!/usr/bin/env ruby
require 'yaml'
require 'pp'
bad_yaml = %Q{---
foo: {a: u[3]}
}
good_yaml = %Q{---
foo: {a: "u[3]"}
}
pp YAML.load(good_yaml)
pp YAML.load(bad_yaml)
arturas@zeus:~/work$ jruby --1.9 yaml_test.rb
{"foo"=>{"a"=>"u[3]"}}
Psych::SyntaxError: while parsing a flow mapping; expected ',' or '}', but got
FlowSequenceStart
parse at org/jruby/ext/psych/PsychParser.java:266
parse_stream at
/home/arturas/.rvm/rubies/jruby-head-n166/lib/ruby/1.9/psych.rb:148
parse at
/home/arturas/.rvm/rubies/jruby-head-n166/lib/ruby/1.9/psych.rb:119
load at
/home/arturas/.rvm/rubies/jruby-head-n166/lib/ruby/1.9/psych.rb:106
(root) at yaml_test.rb:13
{noformat}
Compare this to python parser:
{noformat}
ERROR:
while parsing a flow mapping
in "<unicode string>", line 2, column 6:
foo: {a: u[3]}
^
expected ',' or '}', but got '['
in "<unicode string>", line 2, column 11:
foo: {a: u[3]}
^
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.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