00001
00002
00003
00004
00005
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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00016
00017 namespace OpenDDS {
00018 namespace DCPS {
00019
00020 namespace TopicExpressionGrammar {
00021 using namespace yard;
00022 using namespace text_grammar;
00023 using namespace GrammarUtils;
00024 using FilterExpressionGrammar::FieldName;
00025
00026 struct SELECT : Keyword<CharSeqIgnoreCase<'s', 'e', 'l', 'e', 'c', 't'> > {};
00027 struct FROM : Keyword<CharSeqIgnoreCase<'f', 'r', 'o', 'm'> > {};
00028 struct WHERE : Keyword<CharSeqIgnoreCase<'w', 'h', 'e', 'r', 'e'> > {};
00029 struct INNER : Keyword<CharSeqIgnoreCase<'i', 'n', 'n', 'e', 'r'> > {};
00030 struct NATURAL
00031 : Keyword<CharSeqIgnoreCase<'n', 'a', 't', 'u', 'r', 'a', 'l'> > {};
00032 struct JOIN : Keyword<CharSeqIgnoreCase<'j', 'o', 'i', 'n'> > {};
00033 struct AS : Keyword<CharSeqIgnoreCase<'a', 's'> > {};
00034
00035 struct TopicName : Ident {};
00036 struct NaturalJoin : Or<Seq<INNER, NATURAL, JOIN>,
00037 Seq<NATURAL, Opt<INNER>, JOIN> > {};
00038 struct JoinItem : Or<Seq<ST<TopicName>, Opt<Seq<NaturalJoin, JoinItem> > >,
00039 Seq<LPAREN, ST<TopicName>, NaturalJoin, JoinItem, RPAREN> > {};
00040 struct Selection : Seq<ST<TopicName>, Opt<Seq<NaturalJoin, JoinItem> > > {};
00041
00042 struct FieldAlias : Or<Seq<AS, ST<FieldName> >,
00043 Seq<NotAt<FROM>, ST<FieldName> > > {};
00044 struct SubjectFieldSpec : Seq<ST<FieldName>, Opt<FieldAlias> > {};
00045 struct Aggregation : Or<Tok<Char<'*'> >,
00046 DelimitedList<ST<SubjectFieldSpec>, Tok<Char<','> > > > {};
00047
00048 struct SelectFrom : Seq<SELECT, Aggregation, FROM, Selection> {};
00049 struct WhereClause : Seq<WHERE, Store<FilterExpressionGrammar::Cond> > {};
00050 struct TopicExpr : Seq<SelectFrom, Opt<WhereClause> > {};
00051
00052 struct TopicCompleteInput : Seq<TopicExpr, Opt<Tok<Char<';'> > >,
00053 EndOfInput> {};
00054 }
00055 }
00056 }
00057
00058 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00059
00060 #endif
00061 #endif