# YAML::Syck line numbers?

**URL:** <https://www.ruby-forum.com/t/yaml-syck-line-numbers/107753>\
**Category:** Ruby\
**Created:** [June 25, 2007, 11:30pm UTC](https://www.ruby-forum.com/t/yaml-syck-line-numbers/107753 "2007-06-25T23:30:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [June 25, 2007, 11:30pm UTC](https://www.ruby-forum.com/t/yaml-syck-line-numbers/107753/1 "2007-06-25T23:30:49Z")

</div>

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
