Skip to main content

pywebidl2

Build Status Codecov License Python Version

Description

This is a tool for the Web IDL language.

Quick start

pip install pywebidl2

Usage

Usage: pywebidl2 [OPTIONS] FILE

Options:
  -a, --action [parse|validate]
  --help                         Show this message and exit.

For Developer

Antlr4

Download ANTLR4 tool

Getting Started with ANTLR v4

Create a python parser and lexer.

make parser

Tests

make test

Example

Parser

from pprint import pprint

from pywebidl2 import parse


idl = '''
    interface B {
      void g([AllowAny] DOMString s);
    };
'''

pprint(parse(idl))
[
    {
        "type": "interface",
        "name": "B",
        "inheritance": null,
        "members": [
            {
                "type": "operation",
                "name": "g",
                "idl_type": {
                    "type": "return-type",
                    "ext_attrs": [],
                    "generic": "",
                    "nullable": false,
                    "union": false,
                    "idl_type": "void"
                },
                "arguments": [
                    {
                        "type": "argument",
                        "name": "s",
                        "ext_attrs": [
                            {
                                "type": "extended-attribute",
                                "name": "AllowAny",
                                "rhs": null,
                                "arguments": []
                            }
                        ],
                        "idl_type": {
                            "type": "argument-type",
                            "ext_attrs": [],
                            "generic": "",
                            "nullable": false,
                            "union": false,
                            "idl_type": "DOMString"
                        },
                        "default": null,
                        "optional": false,
                        "variadic": false
                    }
                ],
                "ext_attrs": [],
                "special": ""
            }
        ],
        "ext_attrs": [],
        "partial": false
    }
]

Documentation

See original parser

Contributing

Any help is welcome and appreciated.

License

pywebidl2 is licensed under the terms of the MIT License (see the file LICENSE).

Release files for pywebidl2 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywebidl2 0.1.8
File Size Uploaded
pywebidl2-0.1.8.tar.gz 126.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pywebidl2 0.1.8
File Interpreter ABI Platform
pywebidl2-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 195.6 kB

Release files / pywebidl2-0.1.8.tar.gz

Download URL pywebidl2-0.1.8.tar.gz
Size 126.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f13a5a46d99aad6ca549d3678ef390fcd8a0870b18b2d84e85bf089f7bf87198
BLAKE2b-256 checksum
How to use checksums
9af0dc6a196e2d501de6be9ba8e89a633496702eb11d4055a5268adf6273db8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.6 Linux/6.8.0-101-generic

Release files / pywebidl2-0.1.8-py3-none-any.whl

Download URL pywebidl2-0.1.8-py3-none-any.whl
Size 69.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e6e6bf0d67c9108c4d42064f854ffac8b23ac683849d918c45d7c63b9cd07ef
BLAKE2b-256 checksum
How to use checksums
d6d7dd9c047cc000f75d9e6f97f26f4d60c78b709a8fd6d33d311cba0ada6a90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.6 Linux/6.8.0-101-generic

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page