Skip to main content

WebIDL tool

Project description

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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywebidl2-0.1.7.tar.gz (120.0 kB view details)

Uploaded Source

Built Distribution

pywebidl2-0.1.7-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file pywebidl2-0.1.7.tar.gz.

File metadata

  • Download URL: pywebidl2-0.1.7.tar.gz
  • Upload date:
  • Size: 120.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.8 Linux/5.13.0-39-generic

File hashes

Hashes for pywebidl2-0.1.7.tar.gz
Algorithm Hash digest
SHA256 7c84f3fb77654bf2303a0305d3047b775d0fdcb70560fec9fbbfe8853878a735
MD5 abee3d34af4b7a27003d518e44dc6e3d
BLAKE2b-256 874e638e8fac2fa63c30b5beac311339b8ab5363f55b93518d97937951c0b723

See more details on using hashes here.

File details

Details for the file pywebidl2-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pywebidl2-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.8 Linux/5.13.0-39-generic

File hashes

Hashes for pywebidl2-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a11591aabe00ada55da85cb0de4d96bf2760b30a3f7ed5b65e6a02523cf2d7b4
MD5 7ea82383a14610cd3fbdb3d0359bd36b
BLAKE2b-256 efe19fa6192883ed2ce0a3bd08146fb4a7e05561aa220b534c2e36a836fecd57

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page