Ignore:
Timestamp:
02/20/06 15:30:09 (8 years ago)
Author:
xi
Message:

Implement Composer and BaseResolver?.

File:
1 edited

Legend:

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

    r51 r53  
    11 
     2from error import YAMLError 
    23from reader import Reader 
    34from scanner import Scanner 
    45from parser import Parser 
     6from composer import Composer 
     7from resolver import Resolver 
    58 
    69from tokens import * 
     
    1821    return iter(parser) 
    1922 
     23def 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 
     31def compose_document(*args, **kwds): 
     32    try: 
     33        return compose(*args, **kwds).next() 
     34    except StopIteration: 
     35        return None 
     36 
     37def resolve(data, Reader=Reader, Scanner=Scanner, Parser=Parser, 
     38        Composer=Composer, Resolver=Resolver): 
     39    reader = Reader(data) 
     40    scanner = Scanner(reader) 
     41    parser = Parser(scanner) 
     42    composer = Composer(parser) 
     43    resolver = Resolver(composer) 
     44    return iter(resolver) 
     45 
     46def resolve_document(*args, **kwds): 
     47    try: 
     48        return resolve(*args, **kwds).next() 
     49    except StopIteration: 
     50        return None 
     51 
Note: See TracChangeset for help on using the changeset viewer.