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,6 +138,7 @@ static void setupParserRules()
}; };
search["Format"] = [](const peg::SemanticValues &sv) -> QString { search["Format"] = [](const peg::SemanticValues &sv) -> QString {
if (sv.length() == 1) {
switch (tolower(sv.str()[0])) { switch (tolower(sv.str()[0])) {
case 'm': case 'm':
return "modern"; return "modern";
@ -154,6 +155,9 @@ static void setupParserRules()
default: default:
return ""; return "";
} }
} else {
return QString::fromStdString(sv.str()).toLower();
}
}; };
search["StringValue"] = [](const peg::SemanticValues &sv) -> StringMatcher { search["StringValue"] = [](const peg::SemanticValues &sv) -> StringMatcher {
if (sv.choice() == 0) { if (sv.choice() == 0) {