ignore "deck" at start of a list
add tests
add tests to clangify.sh
This commit is contained in:
ebbit1q
2021-04-02 05:35:36 +02:00
committed by GitHub
parent b940e17fe7
commit 1c48656623
3 changed files with 48 additions and 2 deletions

View File

@@ -492,7 +492,9 @@ bool DeckList::loadFromStream_Plain(QTextStream &in)
const QRegularExpression reEmpty("^\\s*$");
const QRegularExpression reComment("[\\w\\[\\(\\{].*$", QRegularExpression::UseUnicodePropertiesOption);
const QRegularExpression reSBMark("^\\s*sb:\\s*(.+)", QRegularExpression::CaseInsensitiveOption);
const QRegularExpression reSBComment("sideboard", QRegularExpression::CaseInsensitiveOption);
const QRegularExpression reSBComment("^sideboard\\b.*$", QRegularExpression::CaseInsensitiveOption);
const QRegularExpression reDeckComment("^((main)?deck(list)?|mainboard)\\b",
QRegularExpression::CaseInsensitiveOption);
// simplified matches
const QRegularExpression reMultiplier("^[xX\\(\\[]*(\\d+)[xX\\*\\)\\]]* ?(.+)");
@@ -563,6 +565,16 @@ bool DeckList::loadFromStream_Plain(QTextStream &in)
}
comments.chop(1); // remove last newline
// discard empty lines
while (index < max_line && inputs.at(index).contains(reEmpty)) {
++index;
}
// discard line if it starts with deck or mainboard, all cards until the sideboard starts are in the mainboard
if (inputs.at(index).contains(reDeckComment)) {
++index;
}
// parse decklist
for (; index < max_line; ++index) {