diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-03-23 10:45:24 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-03-23 10:45:24 +0800 |
| commit | 14d7e02285857226e26288c1ac83a14eb4fbd478 (patch) | |
| tree | be1ee9300a8516b186b1dc8a057f05b17847cabd /src/MoonP/stacktraceplus.h | |
| parent | c4556457629bebbb632dbf4e87a49e2d684697c2 (diff) | |
| download | yuescript-14d7e02285857226e26288c1ac83a14eb4fbd478.tar.gz yuescript-14d7e02285857226e26288c1ac83a14eb4fbd478.tar.bz2 yuescript-14d7e02285857226e26288c1ac83a14eb4fbd478.zip | |
add support for macro system expanding to Lua codes directly.
Diffstat (limited to 'src/MoonP/stacktraceplus.h')
| -rw-r--r-- | src/MoonP/stacktraceplus.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/MoonP/stacktraceplus.h b/src/MoonP/stacktraceplus.h index fcd887a..ea53885 100644 --- a/src/MoonP/stacktraceplus.h +++ b/src/MoonP/stacktraceplus.h | |||
| @@ -334,16 +334,17 @@ local function getMoonLineNumber(fname, line) | |||
| 334 | end | 334 | end |
| 335 | end | 335 | end |
| 336 | if source then | 336 | if source then |
| 337 | local i, target = 1, tonumber(line) | 337 | local current, target = 1, tonumber(line) |
| 338 | local findLine = line | ||
| 338 | for lineCode in source:gmatch("([^\n]*)\n") do | 339 | for lineCode in source:gmatch("([^\n]*)\n") do |
| 339 | if i == target then | 340 | local num = lineCode:match("--%s*(%d+)%s*$") |
| 340 | local num = lineCode:match("--%s*(%d*)%s*$") | 341 | if num then |
| 341 | if num then | 342 | findLine = num |
| 342 | return fname, num | 343 | end |
| 343 | end | 344 | if current == target then |
| 344 | break | 345 | return fname, findLine or line |
| 345 | end | 346 | end |
| 346 | i = i + 1 | 347 | current = current + 1 |
| 347 | end | 348 | end |
| 348 | end | 349 | end |
| 349 | return fname, line | 350 | return fname, line |
