add pauper to the list of checked formats in search (#3901)

* add pauper to the list of checked formats without a short form

l:p remains reserved for pioneer

* throw out weird hardcoded formats

this will at least still work whenever a format gets added
the shorthands are still kept
This commit is contained in:
ebbit1q 2020-03-17 01:56:30 +01:00 committed by GitHub
parent 1815094249
commit 17efe8c003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ ToughnessQuery <- [Tt] 'ou' 'ghness'? ws? NumericExpression
RarityQuery <- [rR] ':' RegexString RarityQuery <- [rR] ':' RegexString
FormatQuery <- 'f' ':' Format / Legality ':' Format FormatQuery <- 'f' ':' Format / Legality ':' Format
Format <- [Mm] 'odern'? / [Ss] 'tandard'? / [Vv] 'intage'? / [Ll] 'egacy'? / [Cc] 'ommander'? / [Pp] 'ioneer'? Format <- [a-zA-Z] [a-z]*
Legality <- [Ll] 'egal'? / [Bb] 'anned'? / [Rr] 'estricted' Legality <- [Ll] 'egal'? / [Bb] 'anned'? / [Rr] 'estricted'
@ -138,21 +138,25 @@ static void setupParserRules()
}; };
search["Format"] = [](const peg::SemanticValues &sv) -> QString { search["Format"] = [](const peg::SemanticValues &sv) -> QString {
switch (tolower(sv.str()[0])) { if (sv.length() == 1) {
case 'm': switch (tolower(sv.str()[0])) {
return "modern"; case 'm':
case 's': return "modern";
return "standard"; case 's':
case 'v': return "standard";
return "vintage"; case 'v':
case 'l': return "vintage";
return "legacy"; case 'l':
case 'c': return "legacy";
return "commander"; case 'c':
case 'p': return "commander";
return "pioneer"; case 'p':
default: return "pioneer";
return ""; default:
return "";
}
} else {
return QString::fromStdString(sv.str()).toLower();
} }
}; };
search["StringValue"] = [](const peg::SemanticValues &sv) -> StringMatcher { search["StringValue"] = [](const peg::SemanticValues &sv) -> StringMatcher {