Skip to content

Instantly share code, notes, and snippets.

View novakboskov's full-sized avatar

Novak Boškov novakboskov

View GitHub Profile
"""This script checks if some function or method is called in a python
file and prints calls locations if any.
Usage example:
python function_detector.py play.py print cos m
"""
import ast
import sys
int a = 1;
if (a == 1) {
puts("It's one\n");
} else if (a == 2) {
puts("It's not\n");
} else {
puts("C'mon, its much greater\n");
}
if (a == 1) {
#!/usr/bin/env python
""" Usage: <filename> <typename>
Example of C AST introspection using libclang.
Clang version: 5.0.0
Python version: 3.6.2
"""
def get_last_cursor_recursive(c):
if not any(True for _ in c.get_children()):
return c
last = None
for last in c.get_children():
pass
return get_last_cursor_recursive(last)