File: custom.rst

package info (click to toggle)
cxxheaderparser 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,028 kB
  • sloc: python: 18,204; makefile: 33; sh: 9
file content (44 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Custom parsing
==============

For many users, the data provided by the simple API is enough. In some advanced
cases you may find it necessary to use this more customizable parsing mechanism.

First, define a visitor that implements the :class:`CxxVisitor` protocol. Then
you can create an instance of it and pass it to the :class:`CxxParser`.

.. code-block:: python

    visitor = MyVisitor()
    parser = CxxParser(filename, content, visitor)
    parser.parse()

    # do something with the data collected by the visitor

Your visitor should do something with the data as the various callbacks are
called. See the :class:`SimpleCxxVisitor` for inspiration.

API
---

.. automodule:: cxxheaderparser.parser
   :members:
   :undoc-members:

.. automodule:: cxxheaderparser.visitor
   :members:
   :undoc-members:

Parser state 
------------

.. automodule:: cxxheaderparser.parserstate
   :members:
   :undoc-members:

Preprocessor
------------

.. automodule:: cxxheaderparser.preprocessor
   :members:
   :undoc-members: