语法自由Python
项目描述
FreeSyntax
语法自由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
"""))
项目详情
关闭
freesyntax-0.0.1.tar.gz的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 4341eede838de27c2d770d26040536e88c093a64a1ac3694579a9249edb4c4fc |
|
MD5 | aa6504b5999f61969352e1fabaad9a06 |
|
BLAKE2b-256 | b1d9e035a87f6f631f10dc07162fa67ea117a5e43daf73b5f7f8bdf1ec0386f1 |