Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
filter_string.cpp File Reference
#include "filter_string.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/card_localization.h"
#include "libcockatrice/card/database/card_database.h"
#include "libcockatrice/card/printing/printing_info.h"
#include "libcockatrice/card/set/card_set.h"
#include "libcockatrice/card/set/card_set_list.h"
#include <QByteArray>
#include <QChar>
#include <QDate>
#include <QDebug>
#include <QList>
#include <QMessageLogger>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QSharedPointer>
#include <QString>
#include <QStringList>
#include <algorithm>
#include <any>
#include <ctype.h>
#include <functional>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/utility/peglib.h>
#include <mutex>
#include <qnamespace.h>
#include <stddef.h>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for filter_string.cpp:

Functions

static void setupParserRules ()

Variables

static peg::parser search (R"( Start <- QueryPartList ~ws <- [ ]+ QueryPartList <- ComplexQueryPart ( ws ("AND" ws)? ComplexQueryPart)* ws* 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 SetQuery <- ('e'/'set') SetQueryValue SetQueryValue <- ([=:] FlexStringValue) / (<[!][=]?> FlexStringValue) / SetExpression OracleQuery <- 'o' [:] MatcherString CMCQuery <- ('cmc'/'mv') ws? NumericExpression PowerQuery <- [Pp] 'ow' 'er'? ws? NumericExpression ToughnessQuery <- [Tt] 'ou' 'ghness'? ws? NumericExpression RarityQuery <- [rR] ':' Rarity Rarity <- [Cc] 'ommon'? / [Uu] 'ncommon'? / [Rr] 'are'? / [Mm] 'ythic'? / [Ss] 'pecial'? / [a-zA-Z] [a-z]* FormatQuery <- 'f' ':' Format / Legality ':' Format Format <- [a-zA-Z] [a-z]* Legality <- [Ll] 'egal'? / [Bb] 'anned'? / [Rr] 'estricted' TypeQuery <- [tT] 'ype'? [:] StringValue Color <- < [Ww] 'hite'? / [Uu] / [Bb] 'lack'? / [Rr] 'ed'? / [Gg] 'reen'? / [Bb] 'lue'? > ColorEx <- Color / [mc] ColorQuery <- [cC] 'olor'? <[iI]?> <[:!]> ColorEx* FieldQuery <- String [:] MatcherString / String ws? NumericExpression NonDoubleQuoteUnlessEscaped <- '\\\"'. / !["]. NonSingleQuoteUnlessEscaped<- "\\\'"./![']. UnescapedStringListPart<- !['":<>()=! ]. SingleApostropheString <- (UnescapedStringListPart+ ws*)* ['] (UnescapedStringListPart+ ws*)* String <- SingleApostropheString / UnescapedStringListPart+ / ["]< NonDoubleQuoteUnlessEscaped * >["] / ['] <NonSingleQuoteUnlessEscaped*> ['] StringValue <- String / [(] StringList [)] StringList <- StringListString (ws? [,] ws? StringListString)* StringListString <- UnescapedStringListPart+ GenericQuery <- MatcherString # A String that can either be a normal string or a regex search string MatcherString <- RegexMatcher / NormalMatcher NormalMatcher <- String RegexMatcher <- '/' RegexMatcherString '/' RegexMatcherString <- ('\\/' / !'/' .)+ FlexStringValue <- CompactStringSet / String / [(] StringList [)] CompactStringSet <- StringListString ([,+] StringListString)+ SetExpression <- NumericOperator ws? String NumericExpression <- NumericOperator ws? NumericValue NumericOperator <- [=:] / <[><!][=]?> NumericValue <- [0-9]+ )")
static std::once_flag init
CardSearchLanguage searchLanguageContext

Function Documentation

◆ setupParserRules()

void setupParserRules ( )
static

Variable Documentation

◆ init

std::once_flag init
static

◆ search

peg::parser search(R"( Start <- QueryPartList ~ws <- [ ]+ QueryPartList <- ComplexQueryPart ( ws ("AND" ws)? ComplexQueryPart)* ws* 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 SetQuery <- ('e'/'set') SetQueryValue SetQueryValue <- ([=:] FlexStringValue) / (<[!][=]?> FlexStringValue) / SetExpression OracleQuery <- 'o' [:] MatcherString CMCQuery <- ('cmc'/'mv') ws? NumericExpression PowerQuery <- [Pp] 'ow' 'er'? ws? NumericExpression ToughnessQuery <- [Tt] 'ou' 'ghness'? ws? NumericExpression RarityQuery <- [rR] ':' Rarity Rarity <- [Cc] 'ommon'? / [Uu] 'ncommon'? / [Rr] 'are'? / [Mm] 'ythic'? / [Ss] 'pecial'? / [a-zA-Z] [a-z]* FormatQuery <- 'f' ':' Format / Legality ':' Format Format <- [a-zA-Z] [a-z]* Legality <- [Ll] 'egal'? / [Bb] 'anned'? / [Rr] 'estricted' TypeQuery <- [tT] 'ype'? [:] StringValue Color <- < [Ww] 'hite'? / [Uu] / [Bb] 'lack'? / [Rr] 'ed'? / [Gg] 'reen'? / [Bb] 'lue'? > ColorEx <- Color / [mc] ColorQuery <- [cC] 'olor'? <[iI]?> <[:!]> ColorEx* FieldQuery <- String [:] MatcherString / String ws? NumericExpression NonDoubleQuoteUnlessEscaped <- '\\\"'. / !["]. NonSingleQuoteUnlessEscaped<- "\\\'"./![']. UnescapedStringListPart<- !['":<>()=! ]. SingleApostropheString <- (UnescapedStringListPart+ ws*)* ['] (UnescapedStringListPart+ ws*)* String <- SingleApostropheString / UnescapedStringListPart+ / ["]< NonDoubleQuoteUnlessEscaped * >["] / ['] <NonSingleQuoteUnlessEscaped*> ['] StringValue <- String / [(] StringList [)] StringList <- StringListString (ws? [,] ws? StringListString)* StringListString <- UnescapedStringListPart+ GenericQuery <- MatcherString # A String that can either be a normal string or a regex search string MatcherString <- RegexMatcher / NormalMatcher NormalMatcher <- String RegexMatcher <- '/' RegexMatcherString '/' RegexMatcherString <- ('\\/' / !'/' .)+ FlexStringValue <- CompactStringSet / String / [(] StringList [)] CompactStringSet <- StringListString ([,+] StringListString)+ SetExpression <- NumericOperator ws? String NumericExpression <- NumericOperator ws? NumericValue NumericOperator <- [=:] / <[><!][=]?> NumericValue <- [0-9]+ )") ( R"(Start <- QueryPartList~ws <- [ ]+QueryPartList <- ComplexQueryPart ( ws ("AND" ws)? ComplexQueryPart)* ws*ComplexQueryPart <- SomewhatComplexQueryPart ws "OR" ws ComplexQueryPart / SomewhatComplexQueryPartSomewhatComplexQueryPart <- [(] QueryPartList [)] / QueryPartQueryPart <- NotQuery / SetQuery / RarityQuery / CMCQuery / FormatQuery / PowerQuery / ToughnessQuery / ColorQuery / TypeQuery / OracleQuery / FieldQuery / GenericQueryNotQuery <- ('NOT' ws/'-') SomewhatComplexQueryPartSetQuery <- ('e'/'set') SetQueryValueSetQueryValue <- ([=:] FlexStringValue) / (<[!][=]?> FlexStringValue) / SetExpressionOracleQuery <- 'o' [:] MatcherStringCMCQuery <- ('cmc'/'mv') ws? NumericExpressionPowerQuery <- [Pp] 'ow' 'er'? ws? NumericExpressionToughnessQuery <- [Tt] 'ou' 'ghness'? ws? NumericExpressionRarityQuery <- [rR] ':' RarityRarity <- [Cc] 'ommon'? / [Uu] 'ncommon'? / [Rr] 'are'? / [Mm] 'ythic'? / [Ss] 'pecial'? / [a-zA-Z] [a-z]*FormatQuery <- 'f' ':' Format / Legality ':' FormatFormat <- [a-zA-Z] [a-z]*Legality <- [Ll] 'egal'? / [Bb] 'anned'? / [Rr] 'estricted'TypeQuery <- [tT] 'ype'? [:] StringValueColor <- < [Ww] 'hite'? / [Uu] / [Bb] 'lack'? / [Rr] 'ed'? / [Gg] 'reen'? / [Bb] 'lue'? >ColorEx <- Color / [mc]ColorQuery <- [cC] 'olor'? <[iI]?> <[:!]> ColorEx*FieldQuery <- String [:] MatcherString / String ws? NumericExpressionNonDoubleQuoteUnlessEscaped <- '\\\"'. / !["].NonSingleQuoteUnlessEscaped<- "\\\'"./!['].UnescapedStringListPart<- !['":<>()=! ].SingleApostropheString <- (UnescapedStringListPart+ ws*)* ['] (UnescapedStringListPart+ ws*)*String <- SingleApostropheString / UnescapedStringListPart+ / ["]< NonDoubleQuoteUnlessEscaped * >["] / ['] <NonSingleQuoteUnlessEscaped*> [']StringValue <- String / [(] StringList [)]StringList <- StringListString (ws? [,] ws? StringListString)*StringListString <- UnescapedStringListPart+GenericQuery <- MatcherString# A String that can either be a normal string or a regex search stringMatcherString <- RegexMatcher / NormalMatcherNormalMatcher <- StringRegexMatcher <- '/' RegexMatcherString '/'RegexMatcherString <- ('\\/' / !'/' .)+FlexStringValue <- CompactStringSet / String / [(] StringList [)]CompactStringSet <- StringListString ([,+] StringListString)+SetExpression <- NumericOperator ws? StringNumericExpression <- NumericOperator ws? NumericValueNumericOperator <- [=:] / <[><!][=]?>NumericValue <- [0-9]+)" )
static

◆ searchLanguageContext

CardSearchLanguage searchLanguageContext
thread_local