8 #ifndef OPENDDS_DCPS_FILTER_EXPRESSION_GRAMMAR_H 9 #define OPENDDS_DCPS_FILTER_EXPRESSION_GRAMMAR_H 13 #ifndef OPENDDS_NO_CONTENT_SUBSCRIPTION_PROFILE 17 #include "yard/yard_base_grammar.hpp" 18 #include "yard/yard_char_set.hpp" 19 #include "yard/yard_tree.hpp" 20 #include "yard/yard_text_grammar.hpp" 27 namespace GrammarUtils {
31 struct WS : CharSetParser<WhiteSpaceCharSet> {};
32 template<
typename T>
struct Tok : Seq<T, Star<WS> > {};
33 template<
typename T>
struct Keyword :
Tok<Seq<T, NotAlphaNum> > {};
34 template<
typename T>
struct ST :
Tok<Store<T> > {};
37 struct RPAREN : Tok<Char<')'> > {};
39 template<
typename R,
typename D>
43 namespace FilterExpressionGrammar {
46 using namespace GrammarUtils;
49 struct IntValDec : Seq<OptPlusMinus, Plus<Digit>, NotAt<Digit>, NotAt<Or<Char<'x'>, Char<'X'>, Char<'.'> > > > {};
50 struct IntValHex : Seq<CharSeqIgnoreCase<'0', 'x'>, Plus<HexDigit>, NotAlphaNum> {};
56 struct Quote : CharSetParser<CharSet<'\'', '`'> > {};
57 struct CharVal : Seq<Quote, AnyChar, Char<'\''> > {};
59 struct OptExp : Opt<Seq<Char<'e'>, OptPlusMinus, Plus<Digit> > > {};
62 struct FloatVal : Seq<OptPlusMinus, Or<FloatStartWithDigit, FloatStartWithDot>, OptExp, NotAlphaNum> {};
64 struct StrVal : Seq<Quote, Star<AnyCharExcept<CharSet<'\n', '\''> > >, Char<'\''> > {};
66 struct ParamVal : Seq<Char<'%'>, Digit, Opt<Digit> > {};
68 struct Param :
Tok<Or<Store<IntVal>, Store<CharVal>, Store<FloatVal>, Store<StrVal>, Store<ParamVal> > > {};
70 struct AND :
Keyword<CharSeqIgnoreCase<'a', 'n', 'd'> > {};
71 struct OR :
Keyword<CharSeqIgnoreCase<'o', 'r'> > {};
72 struct NOT :
Keyword<CharSeqIgnoreCase<'n', 'o', 't'> > {};
73 struct BETWEEN :
Keyword<CharSeqIgnoreCase<'b', 'e', 't', 'w', 'e', 'e', 'n'> > {};
77 struct OP_LT :
Tok<Seq<Char<'<'>, NotAt<Or<Char<'='>, Char<'>'> > > > > {};
78 struct OP_GT :
Tok<Seq<Char<'>'>, NotAt<Char<'='> > > > {};
80 struct OP_GTEQ : Tok<Seq<Char<'>'>, Char<'='> > > {};
81 struct OP_NEQ :
Tok<Seq<Char<'<'>, Char<'>'> > > {};
96 struct CallDef : Seq< ST<FieldName>, Opt<Seq<Tok<Char<'('> >, DelimitedList<Primary, Tok<Char<','> > >, Tok<Char<')'> > > > > { };
97 struct Call : Store<CallDef> { };
103 struct BetweenPredDef : Seq<ST<FieldName>, Or<Store<BETWEEN>, Store<NOT_BETWEEN> >, Param, AND, Param> {};
113 struct CondTail : Opt<Seq<Or<Store<AND>, Store<OR> >, Cond, CondTail> > {};
116 Seq<Store<NOT>, Cond, CondTail>,
117 Seq<LPAREN, Cond, RPAREN, CondTail>
119 struct Cond : Store<CondDef> { };
122 struct ORDERBY :
Keyword<CharSeqIgnoreCase<'o', 'r', 'd', 'e', 'r', ' ', 'b', 'y'> > {};
123 struct Query : Seq<Opt<Cond>, Opt<Seq<Store<ORDERBY>, DelimitedList<ST<FieldName>, Tok<Char<','> > > > > > {};
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.