Update to rcsparse r2495.
[cvs2svn.git] / cvs2svn_rcsparse / __init__.py
blob049f36cdc6c225f58d8626fdd7c0683411c24518
1 # -*-python-*-
3 # Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
5 # By using this file, you agree to the terms and conditions set forth in
6 # the LICENSE.html file which can be found at the top level of the ViewVC
7 # distribution or at http://viewvc.org/license-1.html.
9 # For more information, visit http://viewvc.org/
11 # -----------------------------------------------------------------------
13 """This package provides parsing tools for RCS files.
15 To use this package, first create a subclass of Sink. This should
16 declare all the callback methods you care about. Create an instance
17 of your class, and open() the RCS file you want to read. Then call
18 parse() to parse the file.
19 """
21 # Make the "Sink" class and the various exception classes visible in this
22 # scope. That way, applications never need to import any of the
23 # sub-packages.
24 from common import *
26 try:
27 from tparse import parse
28 except ImportError:
29 try:
30 from texttools import Parser
31 except ImportError:
32 from default import Parser
34 def parse(file, sink):
35 """Parse an RCS file.
37 Parameters: FILE is the file object to parse. (I.e. an object of the
38 built-in Python type "file", usually created using Python's built-in
39 "open()" function). It should be opened in binary mode.
40 SINK is an instance of (some subclass of) Sink. It's methods will be
41 called as the file is parsed; see the definition of Sink for the
42 details.
43 """
44 return Parser().parse(file, sink)