Debian Codegraph @

docs/custom.rst

raw
1 Custom parsing
2 ==============
3
4 For many users, the data provided by the simple API is enough. In some advanced
5 cases you may find it necessary to use this more customizable parsing mechanism.
6
7 First, define a visitor that implements the :class:`CxxVisitor` protocol. Then
8 you can create an instance of it and pass it to the :class:`CxxParser`.
9
10 .. code-block:: python
11
12 visitor = MyVisitor()
13 parser = CxxParser(filename, content, visitor)
14 parser.parse()
15
16 # do something with the data collected by the visitor
17
18 Your visitor should do something with the data as the various callbacks are
19 called. See the :class:`SimpleCxxVisitor` for inspiration.
20
21 API
22 ---
23
24 .. automodule:: cxxheaderparser.parser
25 :members:
26 :undoc-members:
27
28 .. automodule:: cxxheaderparser.visitor
29 :members:
30 :undoc-members:
31
32 Parser state
33 ------------
34
35 .. automodule:: cxxheaderparser.parserstate
36 :members:
37 :undoc-members:
38
39 Preprocessor
40 ------------
41
42 .. automodule:: cxxheaderparser.preprocessor
43 :members:
44 :undoc-members: