Hello !
Coming from Python using libclang bindings, I'm looking for a Quick Start guide to use PASTA.
A simple example such as this, but using PASTA (pypasta) instead of Clang (libclang and clang.cindex) Python bindings would be super useful as a Python bootstrap guide:
import clang.cindex
import sys
idx = clang.cindex.Index.create()
tu = idx.parse('example.cpp')
for diagnostic in tu.diagnostics:
if diagnostic.severity >= clang.cindex.Diagnostic.Warning:
print(f"Diagnostic: {diagnostic.spelling}")
print(f"Translation unit spelling: {tu.cursor.spelling}")
for child_cursor in tu.cursor.get_children():
if child_cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL:
function_name = child_cursor.spelling
return_type = child_cursor.result_type.spelling
location = child_cursor.location
print(f"\nFound Function: {function_name}")
print(f" Return type: {return_type}")
print(f" Location: line={location.line}, column={location.column}")
for param in child_cursor.get_children():
if param.kind == clang.cindex.CursorKind.PARM_DECL:
print(f" Parameter: {param.spelling} (Type: {param.type.spelling})")
Hello !
Coming from Python using libclang bindings, I'm looking for a Quick Start guide to use PASTA.
A simple example such as this, but using PASTA (
pypasta) instead of Clang (libclangandclang.cindex) Python bindings would be super useful as a Python bootstrap guide: