Skip to content

Commit

Permalink
Handle Minetest Lua traceback lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
Poikilos committed Mar 12, 2020
1 parent bddb1a5 commit 63cadc5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -798,8 +810,12 @@ void MainWindow::lineInfo(std::map<QString, QString>* 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)
Expand Down

0 comments on commit 63cadc5

Please sign in to comment.