Forum: Ruby YAML::Syck line numbers?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
89b03275ec88784f70165ca283894e12?d=identicon&s=25 Dan Kirkwood (dangogh)
on 2007-06-25 23:30
(Received via mailing list)
I've dug through the YAML::Syck library source and the Ruby library,
but was unable to find what I'm looking for..    If the syck parser
finds a syntax error,  it reports the line number of the error.   Is
there a way to obtain line numbers of elements after a successful
load?   This will be necessary in reporting errors in the semantics of
a configuration file..

For example:
pets = "---\nPets:\n  boss: { species: feline }\n  abby: { specied:
canine }\n...\n"
y = YAML::load(pets)
y['Pets']['abby'].line_number
>> 3

Has anyone looked at doing this?  Is the capability available from the
libsyck library?  I'm interested in getting this info through both the
Ruby and Perl libraries..

-dan
This topic is locked and can not be replied to.