跳转到主要内容

语法自由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 (48.2 kB 查看哈希)

上传时间:

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面