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.8.tar.gz (126.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywebidl2-0.1.8-py3-none-any.whl (69.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pywebidl2-0.1.8.tar.gz
  • Upload date:
  • Size: 126.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.6 Linux/6.8.0-101-generic

File hashes

Hashes for pywebidl2-0.1.8.tar.gz
Algorithm Hash digest
SHA256 f13a5a46d99aad6ca549d3678ef390fcd8a0870b18b2d84e85bf089f7bf87198
MD5 8524b09a359cdbabba308e31615236ae
BLAKE2b-256 9af0dc6a196e2d501de6be9ba8e89a633496702eb11d4055a5268adf6273db8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pywebidl2-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 69.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.6 Linux/6.8.0-101-generic

File hashes

Hashes for pywebidl2-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 8e6e6bf0d67c9108c4d42064f854ffac8b23ac683849d918c45d7c63b9cd07ef
MD5 0edce39f67e8923679df867a5ae39c2d
BLAKE2b-256 d6d7dd9c047cc000f75d9e6f97f26f4d60c78b709a8fd6d33d311cba0ada6a90

See more details on using hashes here.

Supported by

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