feat(asm,err,typedef): 支持 __asm__/__llvmir__ 裸名与 typedef 语法糖;解析报错统一 Python 风格 traceback

CallGenCBuiltin/CallGenDispatch: __asm__/__llvmir__ 裸名调用,asminp/asmout/irinp/irout 与裸 ASM_DESCR。

AssignGenMixin: 支持 define NAME: T = V 形式的 CDefine 浮点值恢复;负浮点(-1e308)剥一层 UnaryOp(USub)。

Phase1Main/Phase2: AST 解析失败改调 GenApi.dump_parse_traceback(Traceback + File/行 + 源码行 + caret)。

TypeGenResolve/TypeGenCType: typedef 文本扫描统一支持 typedef 语法糖(builtins/库/单文件三处共用同一解析)。
This commit is contained in:
TermiNexus committed 2026-09-25 13:11:16 +08:00
1 parent a7af34bd7e
commit 676c19c362
7 files changed
+245 -171

No files matched your search

+6 -4
View File
@@ -779,10 +779,12 @@ def RunPhase1(mb: memhub.MemBuddy*, includes_dir: str, temp_dir: str,
if tree_pv is None:
stdlib.free(src_buf_pv)
p1bpre_failed += 1
VLogger.error(
f"[Phase 1b-pre] {file_path_pv} | AST 解析失败"
f"(第 {ast.get_parse_err_line()} 行第 {ast.get_parse_err_col()} 列: "
f"{ast.get_parse_err_msg()})", "Phase1")
# 解析失败:改由 Python 风格 traceback 统一上报(Traceback + File/行 +
# 源码行 + caret + SyntaxError: 消息;消息本身含 token 类型与前/后 token
# 附注,见 includes/ast/parser.vp 的 _record_parse_err_ctx),与单文件
# 管线 BuildPipeline 同一条上报路径。
VLogger.error(f"[Phase 1b-pre] {file_path_pv} | AST 解析失败", "Phase1")
GenApi.dump_parse_traceback(file_path_pv)
continue
pyi_buf_pv: bytes = stdlib.malloc(Phase1.PYI_BUF_SIZE)
if pyi_buf_pv is not None:
+6 -4
View File
@@ -805,10 +805,12 @@ def RunMultiFileProject(mb: memhub.MemBuddy*,
if tree_vp2 is None:
stdlib.free(src_buf_vp2)
vpi_failed_p2 += 1
VLogger.error(
f"[Phase A-pre-vpi] {ent_vp2.Path} | AST 解析失败"
f"(第 {ast.get_parse_err_line()} 行第 {ast.get_parse_err_col()} 列: "
f"{ast.get_parse_err_msg()})", "PhaseA")
# 解析失败:改由 Python 风格 traceback 统一上报(Traceback + File/行 +
# 源码行 + caret + SyntaxError: 消息;消息本身含 token 类型与前/后 token
# 附注,见 includes/ast/parser.vp 的 _record_parse_err_ctx),与单文件
# 管线 BuildPipeline 同一条上报路径。
VLogger.error(f"[Phase A-pre-vpi] {ent_vp2.Path} | AST 解析失败", "PhaseA")
GenApi.dump_parse_traceback(ent_vp2.Path)
continue
pyi_buf_vp2: bytes = stdlib.malloc(PYI_BUF_SIZE_P2)
if pyi_buf_vp2 is not None: