diff --git a/App/lib/Phase/Phase1/Phase1Main.vp b/App/lib/Phase/Phase1/Phase1Main.vp index 7800cfc..3a89d28 100644 --- a/App/lib/Phase/Phase1/Phase1Main.vp +++ b/App/lib/Phase/Phase1/Phase1Main.vp @@ -780,11 +780,11 @@ def RunPhase1(mb: memhub.MemBuddy*, includes_dir: str, temp_dir: str, if tree_pv is None: stdlib.free(src_buf_pv) p1bpre_failed += 1 - # 解析失败:改由 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") + # 解析失败:**日志行内联 行/列 + 原因**,并附完整 Python 风格 traceback + # (Traceback + File/行 + 源码行 + caret + SyntaxError: 消息;消息含 token + # 类型与前/后 token 附注,见 includes/ast/parser.vp 的 _record_parse_err_ctx + # / parse_tokens 兜底补记),与单文件管线 BuildPipeline 同一条上报路径。 + VLogger.error(f"[Phase 1b-pre] {file_path_pv} | AST 解析失败(第 {ast.get_parse_err_line()} 行第 {ast.get_parse_err_col()} 列: {ast.get_parse_err_msg()})", "Phase1") GenApi.dump_parse_traceback(file_path_pv) continue pyi_buf_pv: bytes = stdlib.malloc(Phase1.PYI_BUF_SIZE) @@ -984,7 +984,9 @@ def RunPhase1(mb: memhub.MemBuddy*, includes_dir: str, temp_dir: str, tokens: ast.Token* = ast.tokenize(lx) tree: ast.AST* = ast.parse_tokens(mb, tokens) if tree is None: - VLogger.error(f"AST 解析失败: {file_path}", "Phase1") + # 解析失败:行/列 + 原因一并进日志行(原因由 parser.vp 的 _record_* / + # parse_tokens 兜底补记提供) + VLogger.error(f"AST 解析失败: {file_path}(第 {ast.get_parse_err_line()} 行第 {ast.get_parse_err_col()} 列: {ast.get_parse_err_msg()})", "Phase1") stdlib.free(src_buf) failed += 1 continue diff --git a/App/lib/Phase/Phase2/__init__.vp b/App/lib/Phase/Phase2/__init__.vp index 2d00bc3..31e19f0 100644 --- a/App/lib/Phase/Phase2/__init__.vp +++ b/App/lib/Phase/Phase2/__init__.vp @@ -805,11 +805,12 @@ def RunMultiFileProject(mb: memhub.MemBuddy*, if tree_vp2 is None: stdlib.free(src_buf_vp2) vpi_failed_p2 += 1 - # 解析失败:改由 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") + # 解析失败:**日志行内联 行/列 + 原因**(与下方 dump_parse_traceback 的完整 + # Python 风格 traceback 同源:Traceback + File/行 + 源码行 + caret + + # SyntaxError: 消息;消息含 token 类型与前/后 token 附注,见 + # includes/ast/parser.vp 的 _record_parse_err_ctx / parse_tokens 兜底补记)。 + # 只打 "AST 解析失败" 时用户看不到任何定位与原因(traceback 未落到终端时更甚)。 + VLogger.error(f"[Phase A-pre-vpi] {ent_vp2.Path} | AST 解析失败(第 {ast.get_parse_err_line()} 行第 {ast.get_parse_err_col()} 列: {ast.get_parse_err_msg()})", "PhaseA") GenApi.dump_parse_traceback(ent_vp2.Path) continue pyi_buf_vp2: bytes = stdlib.malloc(PYI_BUF_SIZE_P2) diff --git a/App/main.vp b/App/main.vp index 942b656..4b3f186 100644 --- a/App/main.vp +++ b/App/main.vp @@ -33,26 +33,27 @@ import lib.Phase.Phase1.Phase1Main as Phase1Main # Main Pool 1 GiB -POOL_SIZE: t.CDefine = 1073741824 +define POOL_SIZE = 1073741824 # Permanent memory pool size: 2^29 + 264 = 512MB usable, then change to 1 GiB -PERM_POOL_SIZE: t.CDefine = 1073741824 +define PERM_POOL_SIZE = 1073741824 # Code page: UTF-8 (Windows 65001) -CODE_PAGE: t.CDefine = 65001 +define CODE_PAGE = 65001 # Source code buffer size (1MB) -SRC_BUF_SIZE: t.CDefine = 1048576 +define SRC_BUF_SIZE = 1048576 # Version (dev/beta/rc) -V_VIPER_VERSION: t.CDefine = "1.0.3-dev.31 2026-07-27 Non-LTS" -V_TPV_VERSION: t.CArray[char] | t.attr.section(".PRVERSN") = "0.0.3-dev.428" -V_RUNTIME_VERSION: t.CDefine = "0.2.3+19-Non-LTS" -V_TPC_COMMIT: t.CDefine = "e376b949c9" -V_TPV_COMMIT: t.CDefine = "ab0f37e1a8" -V_RUNTIME_COMMIT: t.CDefine = "f087aa88e2" -V_TARGET: t.CDefine = "x86_64-w64-windows-gnu" -V_LLVM: t.CDefine = "22.1.8" -# --repl 模板工程查找缓冲(repl.vpj 命中路径 / 未命中诊断文本) -REPL_PROJ_PATH_CAP: t.CDefine = 1024 -REPL_PROJ_DIAG_CAP: t.CDefine = 2048 +V_TPV_VERSION: __attribute__(section(".PRVERSN")) []char = "0.0.3-dev.428" +define V_VIPER_VERSION = "1.0.4-dev.579 2026-09-27 Non-LTS" +define V_RUNTIME_VERSION = "0.2.3+19-Non-LTS" +define V_TPC_COMMIT = "e376b949c9" +define V_TPV_COMMIT = "ab0f37e1a8" +define V_RUNTIME_COMMIT = "f087aa88e2" +define V_TARGET = "x86_64-w64-windows-gnu" +define V_LLVM = "22.1.8" +# --repl 模板工程查找缓冲(repl.vpj 命中路径 / 未命中诊断文本) +define REPL_PROJ_PATH_CAP = 1024 +define REPL_PROJ_DIAG_CAP = 2048 +a: static int # ============================================================ # main: Command-line entry # ============================================================ @@ -148,7 +149,7 @@ def main() -> int: parser.add_argument("--run", None, argparse.BOOL, 0, None, False, argparse.STORE_TRUE, "Run the generated executable after compilation") parser.add_argument("--rebuild-includes", None, argparse.BOOL, 0, None, False, argparse.STORE_TRUE, "Delete the includes.binary precompiled cache and rebuild all the includes") parser.add_argument("--clear-cache", None, argparse.BOOL, 0, None, False, argparse.STORE_TRUE, "Clear .transpyc_cache global cache") - parser.add_argument("--asan", None, argparse.BOOL, 0, None, False, argparse.STORE_TRUE, "ASan mode: .ll first opt -passes=asan; ASan runtime libs must be declared in project.vpj (linker.static_libs)") + parser.add_argument("--asan", None, argparse.BOOL, 0, None, False, argparse.STORE_TRUE, "ASan mode: .ll first opt -passes=asan; ASan runtime libs must be declared in project.vpj (linker.static_libs)") parser.add_argument("--traceback", None, argparse.BOOL, 0, None, False, argparse.STORE_TRUE, "Traceback mode: force-compile includes/traceback.vp + Install() ctor, llc -frame-pointer=all, link -ldbghelp, export .stackmap") parser.add_argument("--phase2command", None, argparse.STRING, 0, None, False, argparse.STORE, "Do not run llc/link: write Phase2 llc(opt+llc) and clang link commands to the given .bat path") parser.add_argument("--nowarn-register", None, argparse.BOOL, 0, None, False, argparse.STORE_TRUE, "Suppress Phase A dependency WARN") @@ -337,7 +338,7 @@ Target: %s stdio.printf(" 也可用 --project 显式指定工程文件(如本仓库的 TransPyV/project.vpj)\n") argparse.release(args) return 1 - # 加载工程配置(显式 --project / --repl 查找到的 repl.vpj) + # 加载工程配置(显式 --project / --repl 查找到的 repl.vpj) if proj_path is not None: log.banner("工程配置") cfg_ret: int = Config.Load_project_config(proj_path) @@ -536,7 +537,9 @@ Target: %s tokens: ast.Token* = ast.tokenize(lx) tree: ast.AST* = ast.parse_tokens(mb, tokens) if tree is None: - log.error("AST 解析失败", "ast") + # 解析失败:行/列 + 原因一并进日志行(原因由 parser.vp 的 _record_* / + # parse_tokens 兜底补记提供) + log.error(f"AST 解析失败(第 {ast.get_parse_err_line()} 行第 {ast.get_parse_err_col()} 列: {ast.get_parse_err_msg()})", "ast") argparse.release(args) return 1