feat(vast): 新增自研 Viper/Python 语法解析器取代标准库 ast
TPC 侧取缔对 Python 标准库 ast 模块的依赖,改用 lib/vast 包: - Nodes: 与 CPython 3.12 ast 完全同构的 131 个节点类(含抽象基类继承) - Tokenizer: 词法分析(缩进/字符串/f-string/数字/运算符/软关键字) - ExprParser: 表达式递归下降解析(优先级/lambda/推导式/f-string/切片) - Parser: 语句解析(def/class/if/for/try/with/match/import/注解) - Utils/Unparser: walk/dump/unparse/copy_location/literal_eval 等辅助 - 软关键字 fn/fun/func/function 并入解析器, 废除 ExpandSoftKeywords 预处理 - lib/_bootstrap 将 lib 目录加入 sys.path, import vast as ast 零修改替换 - 52 个文件 import ast 替换为 import vast as ast; 94 文件差分测试 0 失败
This commit is contained in:
1 parent
a7bbd68507
commit
6fc9e19e24
62 files changed
+19293
-15066
No files matched your search
+6
-1
@@ -1 +1,6 @@
|
||||
"""TransPyC 编译器核心库"""
|
||||
"""TransPyC 编译器核心库
|
||||
|
||||
任何 ``import lib.*`` 都会先触发 _bootstrap(sys.path 设置:
|
||||
项目根 + lib 目录 + lib/includes),保证 ``import vast`` 直接可用。
|
||||
"""
|
||||
import lib._bootstrap # noqa: F401
|
||||
Reference in new issue
Block a user