This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" Usage: <filename> <typename> | |
Example of C AST introspection using libclang. | |
Clang version: 5.0.0 | |
Python version: 3.6.2 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 |