Syntactically Free Python
Project description
FreeSyntax
Syntactically Free Python
from freesyntax.factory import RuleFactory
from freesyntax.grammar import Optional, Token, Rule, Match
from freesyntax.structs import AutoLeaf
factory = RuleFactory()
@factory.funcdef(
Match["def"],
Token["NAME"],
Rule["parameters"],
Optional[Match["->"], Rule["test"]],
Match["YES"],
Rule["suite"],
)
def fixer(node):
node.children[3].replace(AutoLeaf.COLON)
print(factory.transform("""
def a() YES
pass
"""))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
freesyntax-0.0.1.tar.gz
(48.2 kB
view details)
File details
Details for the file freesyntax-0.0.1.tar.gz
.
File metadata
- Download URL: freesyntax-0.0.1.tar.gz
- Upload date:
- Size: 48.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.8.0 tqdm/4.40.0 CPython/3.9.0a4+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4341eede838de27c2d770d26040536e88c093a64a1ac3694579a9249edb4c4fc |
|
MD5 | aa6504b5999f61969352e1fabaad9a06 |
|
BLAKE2b-256 | b1d9e035a87f6f631f10dc07162fa67ea117a5e43daf73b5f7f8bdf1ec0386f1 |