update handling of keywords: AND, OR, NOT in card search (#5788)

* update hnadling of keywords: AND, OR, NOT in card search

* added and

* update test

* update test

* update OR to not be [oO][rR] and just look for OR

* keyword testing

* adjusted new test

* implement test case for cards with keyword in name

* implement test case to cards with keyword in name

* format

* update test case

* change test cas

* update truth test case

* changed test card search from real cards to fake and added cards

* Update tests/carddatabase/data/cards.xml

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>

* Update tests/carddatabase/filter_string_test.cpp

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>

* Update tests/carddatabase/filter_string_test.cpp

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>

* update formatting

* update cardatabase_test to include +2 cards

* update test case +1 set + 1 type

---------

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
This commit is contained in:
lilyhuang-github 2025-04-20 00:08:00 -04:00 committed by GitHub
parent 26dcb015ce
commit 574ea01e08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 10 deletions

View file

@ -10,15 +10,15 @@
peg::parser search(R"(
Start <- QueryPartList
~ws <- [ ]+
QueryPartList <- ComplexQueryPart ( ws ("and" ws)? ComplexQueryPart)* ws*
QueryPartList <- ComplexQueryPart ( ws ("AND" ws)? ComplexQueryPart)* ws*
ComplexQueryPart <- SomewhatComplexQueryPart ws $or<[oO][rR]> ws ComplexQueryPart / SomewhatComplexQueryPart
ComplexQueryPart <- SomewhatComplexQueryPart ws "OR" ws ComplexQueryPart / SomewhatComplexQueryPart
SomewhatComplexQueryPart <- [(] QueryPartList [)] / QueryPart
QueryPart <- NotQuery / SetQuery / RarityQuery / CMCQuery / FormatQuery / PowerQuery / ToughnessQuery / ColorQuery / TypeQuery / OracleQuery / FieldQuery / GenericQuery
NotQuery <- ('not' ws/'-') SomewhatComplexQueryPart
NotQuery <- ('NOT' ws/'-') SomewhatComplexQueryPart
SetQuery <- ('e'/'set') [:] FlexStringValue
OracleQuery <- 'o' [:] RegexString