TopicExpressionGrammar.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_TOPIC_EXPRESSION_GRAMMAR_H
00009 #define OPENDDS_DCPS_TOPIC_EXPRESSION_GRAMMAR_H
00010 
00011 #ifndef OPENDDS_NO_MULTI_TOPIC
00012 
00013 #include "FilterExpressionGrammar.h"
00014 
00015 namespace OpenDDS {
00016 namespace DCPS {
00017 
00018 namespace TopicExpressionGrammar {
00019   using namespace yard;
00020   using namespace text_grammar;
00021   using namespace GrammarUtils;
00022   using FilterExpressionGrammar::FieldName;
00023 
00024   struct SELECT : Keyword<CharSeqIgnoreCase<'s', 'e', 'l', 'e', 'c', 't'> > {};
00025   struct FROM : Keyword<CharSeqIgnoreCase<'f', 'r', 'o', 'm'> > {};
00026   struct WHERE : Keyword<CharSeqIgnoreCase<'w', 'h', 'e', 'r', 'e'> > {};
00027   struct INNER : Keyword<CharSeqIgnoreCase<'i', 'n', 'n', 'e', 'r'> > {};
00028   struct NATURAL
00029     : Keyword<CharSeqIgnoreCase<'n', 'a', 't', 'u', 'r', 'a', 'l'> > {};
00030   struct JOIN : Keyword<CharSeqIgnoreCase<'j', 'o', 'i', 'n'> > {};
00031   struct AS : Keyword<CharSeqIgnoreCase<'a', 's'> > {};
00032 
00033   struct TopicName : Ident {};
00034   struct NaturalJoin : Or<Seq<INNER, NATURAL, JOIN>,
00035     Seq<NATURAL, Opt<INNER>, JOIN> > {};
00036   struct JoinItem : Or<Seq<ST<TopicName>, Opt<Seq<NaturalJoin, JoinItem> > >,
00037     Seq<LPAREN, ST<TopicName>, NaturalJoin, JoinItem, RPAREN> > {};
00038   struct Selection : Seq<ST<TopicName>, Opt<Seq<NaturalJoin, JoinItem> > > {};
00039 
00040   struct FieldAlias : Or<Seq<AS, ST<FieldName> >,
00041     Seq<NotAt<FROM>, ST<FieldName> > > {};
00042   struct SubjectFieldSpec : Seq<ST<FieldName>, Opt<FieldAlias> > {};
00043   struct Aggregation : Or<Tok<Char<'*'> >,
00044     DelimitedList<ST<SubjectFieldSpec>, Tok<Char<','> > > > {};
00045 
00046   struct SelectFrom : Seq<SELECT, Aggregation, FROM, Selection> {};
00047   struct WhereClause : Seq<WHERE, Store<FilterExpressionGrammar::Cond> > {};
00048   struct TopicExpr : Seq<SelectFrom, Opt<WhereClause> > {};
00049 
00050   struct TopicCompleteInput : Seq<TopicExpr, Opt<Tok<Char<';'> > >,
00051     EndOfInput> {};
00052 }
00053 }
00054 }
00055 #endif
00056 #endif

Generated on Fri Feb 12 20:05:28 2016 for OpenDDS by  doxygen 1.4.7