{"id":18746694,"url":"https://github.com/matrixeditor/aidl-parser","last_synced_at":"2025-11-23T23:30:17.597Z","repository":{"id":233459721,"uuid":"729839972","full_name":"MatrixEditor/aidl-parser","owner":"MatrixEditor","description":"Android Interface Defintion Parser (AIDL) in Python3 - modified fork of javalang, a pure Python parser of the Java language.","archived":false,"fork":false,"pushed_at":"2024-04-16T06:59:18.000Z","size":53,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T20:45:59.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MatrixEditor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-10T14:19:27.000Z","updated_at":"2024-10-20T18:45:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b34eaed-38b9-4f18-aead-57d134627550","html_url":"https://github.com/MatrixEditor/aidl-parser","commit_stats":null,"previous_names":["matrixeditor/aidl-parser"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixEditor%2Faidl-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixEditor%2Faidl-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixEditor%2Faidl-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixEditor%2Faidl-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatrixEditor","download_url":"https://codeload.github.com/MatrixEditor/aidl-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239629292,"owners_count":19671257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T16:26:33.078Z","updated_at":"2025-11-23T23:30:17.331Z","avatar_url":"https://github.com/MatrixEditor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Android Interface Definition Language (AIDL) Parser\n\n[![python](https://img.shields.io/badge/python-3.8+-blue.svg?logo=python\u0026labelColor=grey)](https://www.python.org/downloads/)\n![Codestyle](https://img.shields.io:/static/v1?label=Codestyle\u0026message=black\u0026color=black)\n![License](https://img.shields.io:/static/v1?label=License\u0026message=MIT\u0026color=blue)\n[![Parent Repository](https://img.shields.io:/static/v1?label=Parent\u0026message=c2nes/javalang\u0026color=lightgrey)](https://github.com/c2nes/javalang)\n\n\u003e [!Warning]\n\u003e This repository aims to provide an implementation of an AIDL parser in Python. For information about the original repository, visit [c2nes/javalang](https://github.com/c2nes/javalang).\n\n`aidl-parser` is a small Python library that can be used to lex and parse Android Interface Definition Language (AIDL) files as well as default Java files.\n\n## Installation\n\nFirst, clone the repository and change the working directory. Next, install the python library to your local site-packages.\n\n```bash\ngit clone https://github.com/MatrixEditor/aidl-parser.git\ncd aidl-parser \u0026\u0026 pip install .\n```\n\n\n## Getting Started\n\n```python\n\u003e\u003e\u003e import aidl\n\u003e\u003e\u003e unit = aidl.fromstring(\"package com.example; parcelable Foo;\")\n```\n\nThe call above will return an instance of `CompilationUnit`. This particular object serves as the root of a tree structure that can be navigated to retrieve various pieces of information regarding the compilation unit.\n\n```python\n\u003e\u003e\u003e unit.package.name\n'com.example'\n\u003e\u003e\u003e unit.types[0]\nParcelableDeclaration\n\u003e\u003e\u003e unit.types[0].name\n'Foo'\n```\n\nThe string provided to `aidl.fromstring` must represent a complete unit, indicating that it should represent a valid AIDL or Java source file in its entirety. However, other functions within the `aidl.parse` module enable the parsing of smaller code snippets without the need to supply a complete compilation unit.\n\n## AIDL Types\n\n### `Parcelable`\n\nAs a simple parcelable defintion can be just a reference to the Java implementation file, there will be a special attribute named `is_ref`. It will indicate the presence of a Java implementation file. The `cpp_header` stores an optional C++ file reference.\n\n    ParcelableDeclaration(\n        is_ref: bool\n        name: str\n        cpp_header: str\n    )\n\nAn example AIDL file with a parcelable would look like this:\n```aidl\npackage com.example;\n\nparcelable Foo cpp_header \"native/include/Foo.h\";\n```\n\n### `Binder`\n\nBinder declarations will be treated as `InterfaceDeclaration` objects internally. As the AIDL specification contains new keywords, the following example tries to illustrates their use case:\n\n```aidl\npackage com.example;\n\nimport com.example.Foo; // all types must be imported\n\n// 'oneway' indicates we don't get a result\noneway interface FooListener {\n    // all non-primitive types except String, IBinder and AIDL-generated\n    // interfaces must be defined with a directional tag: in, out, inout\n    void onActionPerformed(in @nullable Foo foo) = 2; // manually defined transaction code\n}\n```\n\nFor more information about how to write AIDL files, use the [Android Developer](https://developer.android.com/guide/components/aidl?hl=en) reference on AIDL.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrixeditor%2Faidl-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatrixeditor%2Faidl-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrixeditor%2Faidl-parser/lists"}