source: branches/pyyaml3000/lib/yaml/__init__.py @ 55

Revision 55, 886 bytes checked in by xi, 8 years ago (diff)

Working on Constructor.

RevLine 
[51]1
[53]2from error import YAMLError
[51]3from reader import Reader
4from scanner import Scanner
5from parser import Parser
[53]6from composer import Composer
7from resolver import Resolver
[55]8from constructor import Constructor
[51]9
10from tokens import *
11from events import *
[55]12from nodes import *
[51]13
14def parse(data, Reader=Reader, Scanner=Scanner, Parser=Parser):
15    reader = Reader(data)
16    scanner = Scanner(reader)
17    parser = Parser(scanner)
[55]18    return parser
[51]19
[55]20def load(data, Reader=Reader, Scanner=Scanner, Parser=Parser,
21        Composer=Composer, Resolver=Resolver, Constructor=Constructor):
[53]22    reader = Reader(data)
23    scanner = Scanner(reader)
24    parser = Parser(scanner)
25    composer = Composer(parser)
26    resolver = Resolver(composer)
[55]27    constructor = Constructor(resolver)
28    return constructor
[53]29
[55]30def load_document(*args, **kwds):
31    for document in load(*args, **kwds):
32        return document
[53]33
Note: See TracBrowser for help on using the repository browser.