Fix up Rubinius specific library specs.
[rbx.git] / lib / rbyaml / loader.rb
blob56b2d649dcae105a1a489ee9b4e34a5a06fc05f9
1 # This is a more or less straight translation of PyYAML3000 to Ruby
3 require 'rbyaml/scanner'
4 require 'rbyaml/parser'
5 require 'rbyaml/composer'
6 require 'rbyaml/constructor'
7 require 'rbyaml/resolver'
9 module RbYAML
10   class CommonLoader
11     attr_accessor :scanner, :parser, :composer, :constructor, :resolver
13     def initialize(stream,scanner=Scanner,parser=Parser,composer=Composer,constructor=BaseConstructor,resolver=BaseResolver)
14       @scanner = scanner.new(stream)
15       @parser = parser.new(@scanner)
16       @resolver = resolver.new
17       @composer = composer.new(@parser,@resolver)
18       @constructor = constructor.new(@composer)
19     end
20   end
21   
22   class BaseLoader < CommonLoader
23     def initialize(stream)
24       super(stream,Scanner,Parser,Composer,BaseConstructor,BaseResolver)
25     end
26   end
27   
28   class SafeLoader < CommonLoader
29     def initialize(stream)
30       super(stream,Scanner,Parser,Composer,SafeConstructor,Resolver)
31     end
32   end
33   
34   class Loader < CommonLoader
35     def initialize(stream)
36       super(stream,Scanner,Parser,Composer,Constructor,Resolver)
37     end
38   end
39 end