Ignore:
Timestamp:
02/22/06 19:18:34 (8 years ago)
Author:
xi
Message:

Working on Constructor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pyyaml3000/lib/yaml/__init__.py

    r53 r55  
    66from composer import Composer 
    77from resolver import Resolver 
     8from constructor import Constructor 
    89 
    910from tokens import * 
    1011from events import * 
    11  
    12 def scan(data, Reader=Reader, Scanner=Scanner): 
    13     reader = Reader(data) 
    14     scanner = Scanner(reader) 
    15     return iter(scanner) 
     12from nodes import * 
    1613 
    1714def parse(data, Reader=Reader, Scanner=Scanner, Parser=Parser): 
     
    1916    scanner = Scanner(reader) 
    2017    parser = Parser(scanner) 
    21     return iter(parser) 
     18    return parser 
    2219 
    23 def compose(data, Reader=Reader, Scanner=Scanner, Parser=Parser, 
    24         Composer=Composer): 
    25     reader = Reader(data) 
    26     scanner = Scanner(reader) 
    27     parser = Parser(scanner) 
    28     composer = Composer(parser) 
    29     return iter(composer) 
    30  
    31 def compose_document(*args, **kwds): 
    32     try: 
    33         return compose(*args, **kwds).next() 
    34     except StopIteration: 
    35         return None 
    36  
    37 def resolve(data, Reader=Reader, Scanner=Scanner, Parser=Parser, 
    38         Composer=Composer, Resolver=Resolver): 
     20def load(data, Reader=Reader, Scanner=Scanner, Parser=Parser, 
     21        Composer=Composer, Resolver=Resolver, Constructor=Constructor): 
    3922    reader = Reader(data) 
    4023    scanner = Scanner(reader) 
     
    4225    composer = Composer(parser) 
    4326    resolver = Resolver(composer) 
    44     return iter(resolver) 
     27    constructor = Constructor(resolver) 
     28    return constructor 
    4529 
    46 def resolve_document(*args, **kwds): 
    47     try: 
    48         return resolve(*args, **kwds).next() 
    49     except StopIteration: 
    50         return None 
     30def load_document(*args, **kwds): 
     31    for document in load(*args, **kwds): 
     32        return document 
    5133 
Note: See TracChangeset for help on using the changeset viewer.