AIDL Utilities#

Public API#

aidl.AIDL = <tree_sitter.Language object>#

Public tree-sitter language object for AIDL source code files.

aidl.JAVA = <tree_sitter.Language object>#

Public tree-sitter language object for Java source code files, which was generated using Tree-Sitter-Java

bshark.aidl.parse_aidl(text: bytes) Tree[source]#

Parses the given AIDL file and returns the AST.

bshark.aidl.parse_java(text: bytes) Tree[source]#

Parses the given Java file and returns the AST.

class bshark.aidl.Type[source]#

The type of a unit.

BINDER = 2#

An interface definition (binder) from an AIDL file.

PARCELABLE = 0#

A parcelable class (directly from an AIDL file).

PARCELABLE_JAVA = 1#

A parcelable class, which was loaded from a Java file.

SPECIAL = 3#
UNDEFINED = 4#
class bshark.aidl.Unit(package: str, imports: List[str], name: str, type: Type, body: Node)[source]#

A compilation unit describes either a Java class, a binder interface or a parcelable declaration.

body: Node#

The unit’s AST

Note that this value may be a ParcelableDef of BinderDef if imported through a JSON file.

imports: List[str]#

The imports of this unit (static imports omitted)

name: str#

The name of this unit

package: str#

The package name of this unit

type: Type#

The type of this unit

Internal API#

bshark.aidl.get_imports(program: Node, lang: Language) List[str][source]#

Returns the imports of the given program.

bshark.aidl.get_package(program: Node, lang: Language) str | None[source]#

Returns the package of the given program.

bshark.aidl.get_class_by_name(program: Node, name: str, lang: Language) Node | None[source]#

Returns the class node in the given program.

bshark.aidl.get_method_by_name(program: Node, name: str, lang: Language) Node | None[source]#

Returns the method node in the given program.

bshark.aidl.get_parcelables(program: Node) List[Node][source]#

Returns the parcelable nodes in the given program.

bshark.aidl.get_binder_methods(program: Node) Dict[str, Node][source]#

Returns the binder method nodes in the given program.

bshark.aidl.get_parameters(program: Node, lang: Language, param_type: str | None = None) Dict[str, Node][source]#

Returns the parameter nodes in the given program.

bshark.aidl.get_methods(program: Node, lang: Language, method_type: str | None = None, scope: Node | None = None) Dict[str, Node][source]#

Returns the method nodes in the given program.

bshark.aidl.get_method_return_type(program: Node) str[source]#

Returns the return type of a method node

bshark.aidl.get_parameter_modifier(program: Node) str[source]#

Returns the modifier of a parameter node