From c857b3b83c7485693bfcc2b65e9e6e95107396f4 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 25 Apr 2024 10:59:47 +0800 Subject: [PATCH] fix a traceback rewrite issue. --- src/yuescript/stacktraceplus.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yuescript/stacktraceplus.h b/src/yuescript/stacktraceplus.h index 3167ba8..594afb5 100644 --- a/src/yuescript/stacktraceplus.h +++ b/src/yuescript/stacktraceplus.h @@ -1,6 +1,6 @@ R"lua_codes( --[[ -Copyright (c) 2010 Ignacio Burgueño, modified by Li Jin +Copyright (c) 2010 Ignacio Burgueño, modified by Li Jin, 2024 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -335,7 +335,7 @@ local function getYueLineNumber(fname, line) end if file_exist then local codes = yue.read_file(file_path) - local yueFile = codes:match("^%s*--%s*%[.*%]:%s*([^\n]*)") + local yueFile = codes:match("^%s*%-%-%s*%[[^%]]*%]:%s*([^\n]*)") if yueFile then fname = yueFile:gsub("^%s*(.-)%s*$", "%1") source = codes @@ -346,7 +346,7 @@ local function getYueLineNumber(fname, line) local current, target = 1, tonumber(line) local findLine = line for lineCode in source:gmatch("([^\r\n]*)\r?\n?") do - local num = lineCode:match("--%s*(%d+)%s*$") + local num = lineCode:match("%-%-%s*(%d+)%s*$") if num then findLine = num end