From 63cadc510f8ccee4b9b27d4e7a650439211c8518 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Thu, 12 Mar 2020 19:47:21 -0400 Subject: [PATCH] Handle Minetest Lua traceback lines. --- changelog.md | 9 +++++++++ mainwindow.cpp | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index f7b8f6c..cf12f47 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [git] - 2020-03-12 +### Added +- Handle Minetest Lua tracebacks (such as from debug.txt or stderr) + (requires fix below) + +### Fixed +- Handle `PARSE_MARKER_FILE` value not at the start of a line. + + ## [git] - 2020-03-11 ### Added - Allow simpler syntax while avoiding false positives by only allowing diff --git a/mainwindow.cpp b/mainwindow.cpp index abbd000..610a580 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -197,6 +197,18 @@ MainWindow::MainWindow(QWidget* parent) sNoseUpperTracebackMarkers[PARSE_STACK] = ""; enclosures.push_back(sNoseUpperTracebackMarkers); } + { + QStringList sMinetestLuaTracebackMarkers; + for (int i = 0; i < PARSE_PARTS_COUNT; i++) + sMinetestLuaTracebackMarkers.append(""); + sMinetestLuaTracebackMarkers[PARSE_MARKER_FILE] = "ERROR[Main]:"; + sMinetestLuaTracebackMarkers[PARSE_MARKER_PARAM_A] = ":"; + sMinetestLuaTracebackMarkers[PARSE_MARKER_PARAM_B] = ""; + sMinetestLuaTracebackMarkers[PARSE_MARKER_END_PARAMS] = ":"; + sMinetestLuaTracebackMarkers[PARSE_COLLECT] = COLLECT_REUSE; + sMinetestLuaTracebackMarkers[PARSE_STACK] = ""; + enclosures.push_back(sMinetestLuaTracebackMarkers); + } { // TODO: (?) This comment said, "default must iterate LAST (in back)" // BUT Grep syntax is simpler, so must come after it. @@ -798,8 +810,12 @@ void MainWindow::lineInfo(std::map* info, const QString sLineO qInfo().noquote() << "`" + sLineOriginal + "`:"; } for (auto itList = enclosures.begin(); itList != enclosures.end(); itList++) { - if ((((*itList)[PARSE_MARKER_FILE]).length() == 0) || sLine.startsWith((*itList)[PARSE_MARKER_FILE])) { + if ((((*itList)[PARSE_MARKER_FILE]).length() == 0) || sLine.contains((*itList)[PARSE_MARKER_FILE])) { sFileMarker = (*itList)[PARSE_MARKER_FILE]; + if (bDebugParser) { + if (sFileMarker.length() > 0) + qInfo().noquote() << " looking for sFileMarker '" + sFileMarker + "'"; + } sParamAMarker = (*itList)[PARSE_MARKER_PARAM_A]; sParamBMarker = (*itList)[PARSE_MARKER_PARAM_B]; // coordinate delimiter (blank if no column) sEndParamsMarker = (*itList)[PARSE_MARKER_END_PARAMS]; // what is after last coord ("\n" if line ends)