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