Sunday, May 11, 2008

symbol parsing bug has been fixed

In my opinion, maybe rbyaml is ported from pyyaml. And in Python, there is no symbol class. So rbyaml doesn't support symbol parsing at first.

This week, I worked on symbol parsing bug. I spent lots of time on tracking the stream parsing flow with ruby-debug. During the tracking process, I added some spec tests to cover the method call stack.
After I find out the fixing solution. Then I found that bug had been fixed already in rubinius. It really helped me a lot.
Now, RbYAML can parse stream which inlcude symbol smoothly.
You can try it by following code.
RbYAML.load("---\n :firstname: Long\n lastname: Sun")
=> {:firstname=>"Long", "lastname"=>"Sun"}

Wednesday, May 7, 2008

syck bug

These days, I am working on symbol parsing.
I found a bug of syck.
In the document of ruby,
  YAML.parse( "--- :locked" )
#=> # @type_id="tag:ruby.yaml.org,2002:sym",
@value=":locked", @kind=:scalar>
but in fact,
irb(main):002:0> YAML.parse("--- :symbol").type_id
=> "tag:yaml.org,2002:str"

Monday, May 5, 2008

load symbol as string

Currently, I think loading symbol as string is a defect of rbyaml.
For example,
>RbYAML.load("--- :sym")
=> ":sym" # It's a string
>YAML.load("--- :sym")
=> :sym # It's a symbol


Starting working on that defect.
You can see more tasks and defects in following URL,
http://code.google.com/p/rbyaml/issues/list

spec test for rbyaml

These days, I have taken a look at rbyaml, yaml interface and jvyamlb. And now have a outline about yaml processor.
Comparing to rbyaml and MRI, the spec tests in rubinius are more detailed, that tests are for each method.
Formerly, I just wondered how to organize spec tests, however, now I think rubinius made a very good organization for spec tests.
So I ported yaml and rbyaml spec tests from rubinius to rbyaml.
Now I am working on modifying yaml spec tests, I want to make them becoming rbyaml spec tests.
During porting, I found some bugs under current rbyaml.
I am going to fix them and add more specs during fixing bugs.

Tuesday, April 29, 2008

Compared to MRI YAML interface, what rbyaml missing

After compared rbyaml.rb to yaml.rb which is from MRI, I've summarized some missing methods.
Mainly, we need some class variables for RbYAML now, just like parser, emitter and resolver(named as loader in RbYAML)

More information as follows.
  • rbyaml.rb[main interface]
    • missing method
      • parser
        • using resolver method
      • generic_parser
        • using GenericResolver
      • resolver
        • return DefaultResolver
      • emitter
        • using resolver method
      • parse
        • generic_parser.load
      • parse_file
        • parse
      • each_node
        • parser.load_documents
      • parse_documents
        • each_node
      • add_*_type
        • resolver.add_type(loader in rbyaml)
      • tagurize
        • resolver.tagurize
      • transfer
        • resolver.transfer
      • try_implicit
        • transfer & detect_implicit
      • quick_emit
        • using emmitter, there's quick_emit_node in RbYaml, there are not the same
      • Kernel.y
        • like p, y is a really convenient way to YAML.dump

Monday, April 28, 2008

Found a comrade

There is a rubyspec project in GSoC2008 by Federico Builes. It will support both rubinius and MRI.
(Specs for Ruby Standard Libraries)
Most glad thing is, it will also include YAML spec tests.
Maybe we can help each other about YAML spec.
:)

Fisheye for RbYAML

FishEye is a source repository browsing system that allows you to monitor, search and analyse changes in your codebase.

Now fisheye for rbyaml is available.
(http://fisheye2.cenqua.com/browse/rbyaml/)