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

Revision 51, 429 bytes checked in by xi, 9 years ago (diff)

Parser is done. Add iterator interfaces for Scanner and Parser.

Line 
1
2from reader import Reader
3from scanner import Scanner
4from parser import Parser
5
6from tokens import *
7from events import *
8
9def scan(data, Reader=Reader, Scanner=Scanner):
10    reader = Reader(data)
11    scanner = Scanner(reader)
12    return iter(scanner)
13
14def parse(data, Reader=Reader, Scanner=Scanner, Parser=Parser):
15    reader = Reader(data)
16    scanner = Scanner(reader)
17    parser = Parser(scanner)
18    return iter(parser)
19
Note: See TracBrowser for help on using the repository browser.