Source code for ctree.cpp.dotgen

"""
DOT generation for C preprocessor directives.
"""

from ctree.dotgen import DotGenLabeller


[docs]class CppDotLabeller(DotGenLabeller): """ Visitor to generator DOT. """
[docs] def visit_CppInclude(self, node): if node.angled_brackets: return "target: <%s>" % node.target else: return 'target: "%s"' % node.target
[docs] def visit_CppComment(self, node): return "// " + node.text.replace('"', r"\"")