mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Add bpf decorator, start rewrite
This commit is contained in:
@ -9,10 +9,15 @@ from .globals_pass import globals_processing
|
|||||||
def processor(source_code, filename, module):
|
def processor(source_code, filename, module):
|
||||||
tree = ast.parse(source_code, filename)
|
tree = ast.parse(source_code, filename)
|
||||||
print(ast.dump(tree, indent=4))
|
print(ast.dump(tree, indent=4))
|
||||||
constants_processing(tree, module)
|
|
||||||
license_processing(tree, module)
|
# For now, we will parse the BPF specific parts of AST
|
||||||
globals_processing(tree, module)
|
# Big rewrite
|
||||||
functions_processing(tree, module)
|
|
||||||
|
# will worry later
|
||||||
|
# constants_processing(tree, module)
|
||||||
|
# license_processing(tree, module)
|
||||||
|
# globals_processing(tree, module)
|
||||||
|
# functions_processing(tree, module)
|
||||||
|
|
||||||
|
|
||||||
def compile_to_ir(filename: str, output: str):
|
def compile_to_ir(filename: str, output: str):
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
def bpf(func):
|
||||||
|
"""Decorator to mark a function for BPF compilation."""
|
||||||
|
func._is_bpf = True
|
||||||
|
return func
|
||||||
|
|
||||||
|
|
||||||
def section(name: str):
|
def section(name: str):
|
||||||
def wrapper(fn):
|
def wrapper(fn):
|
||||||
fn._section = name
|
fn._section = name
|
||||||
|
|||||||
Reference in New Issue
Block a user