ast

Utils for ast-based patching.

Warning

This only supports C++ with tree-sitter-cpp yet

class ptcx.ast.FuncSign(source, lang_str, query_str=None)View on GitHub

Signature of a Cpp function or declaration

Parameters:
parser: Parser

language-specific parser used

lang_str: str

language as str, has to be valid for sourcetypes3

tree: Tree

AST tree of source

name: bytes

Function name (including scope)

ret_type: bytes

Return type of function (excluding scope)

body: bytes

Body of function provided in source

source: bytes

Source code this signature is based on

is_declaration: bool = False

If provide source is a declaration, not in fact function

query: Query

Query which matches any function with this signature

property params: List [List [bytes ]]View on GitHub

Parameters in the form

rplace(node)View on GitHub

Place ptcx.FuncSign.ast.body in other node at same or similar function signature.

Parameters:

node (Node )