From: Ryan Davis Date: 2010-04-17T18:07:14+09:00 Subject: Re: Writing a parser On Apr 17, 2010, at 01:54 , Martin Hansen wrote: > This is not YAML. YAML allows arbitrarily complex data structures, and > the separator comes before the data (for some stupid reason). One could > possibly parse this data with a YAML parser, but my experience with the > YAML-syck parser (from Perl), which is written in C, is that it is much > slower than a simple parser. And I want speed. And you chose ruby? Ruby isn't exactly known for speed. And I can practically guarantee you that the syck parser will be faster for hashes of strings than your parser (as it is currently written and several minor iterations out). But no, what you described IS yaml, it is just a subset of yaml. You can enforce the subset-ness if you feel like it, but I'm not a big fan of static typing, so I don't recommend it. At the very least, you should look at StringScanner and a full rewrite, drop the silly Record class entirely and build up proper hashes of strings. And don't leave those dangling File objects everywhere. Read the whole file or use the block form of file.open.