pr feedback

This commit is contained in:
Ari Lazier 2015-11-23 08:47:09 -08:00
parent 8d13ec1adc
commit 2109520913
2 changed files with 11 additions and 7 deletions

View File

@ -151,7 +151,7 @@ template<> struct action< and_ext >
// if we were put into an OR group we need to rearrange
auto &current = state.current();
if (current.type == Predicate::Type::Or) {
auto &sub_preds = state.current().cpnd.sub_predicates;
auto &sub_preds = current.cpnd.sub_predicates;
auto &second_last = sub_preds[sub_preds.size()-2];
if (second_last.type == Predicate::Type::And) {
// if we are in an OR group and second to last predicate group is
@ -320,7 +320,7 @@ Predicate parse(const std::string &query)
return std::move(out_predicate);
}
void analyzeGrammer()
void analyzeGrammar()
{
analyze<pred>();
}

View File

@ -36,7 +36,8 @@ namespace realm {
struct Predicate
{
enum class Type {
enum class Type
{
Comparison,
Or,
And,
@ -44,7 +45,8 @@ namespace realm {
False
} type = Type::And;
enum class Operator {
enum class Operator
{
None,
Equal,
NotEqual,
@ -57,13 +59,15 @@ namespace realm {
Contains
};
struct Comparison {
struct Comparison
{
Operator op = Operator::None;
Expression expr[2];
~Comparison() {}
};
struct Compound {
struct Compound
{
std::vector<Predicate> sub_predicates;
};
@ -77,7 +81,7 @@ namespace realm {
Predicate parse(const std::string &query);
void analyzeGrammer();
void analyzeGrammar();
bool testGrammer();
}
}