mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-02 21:17:01 +00:00
cql3: grammar: remove duplication around columnCondition scalar/collection variants
columnCondition duplicates the grammar for scalar relations and subscripted collection relations. Eliminate the duplication by introducing a subscriptExpr production, which encapsulates the differences.
This commit is contained in:
38
cql3/Cql.g
38
cql3/Cql.g
@@ -1682,9 +1682,14 @@ columnRefExpr returns [expression e]
|
||||
: column=cident { e = unresolved_identifier{column}; }
|
||||
;
|
||||
|
||||
subscriptExpr returns [expression e]
|
||||
: col=columnRefExpr { e = std::move(col); }
|
||||
( '[' sub=term ']' { e = subscript{std::move(e), std::move(sub)}; } )?
|
||||
;
|
||||
|
||||
columnCondition[conditions_type& conditions]
|
||||
// Note: we'll reject duplicates later
|
||||
: key=columnRefExpr
|
||||
: key=subscriptExpr
|
||||
( op=relationType t=term { conditions.emplace_back(
|
||||
binary_operator(
|
||||
key,
|
||||
@@ -1705,37 +1710,6 @@ columnCondition[conditions_type& conditions]
|
||||
marker1));
|
||||
}
|
||||
)
|
||||
| '[' element=term ']'
|
||||
( op=relationType t=term { conditions.emplace_back(
|
||||
binary_operator(
|
||||
subscript{
|
||||
key,
|
||||
element
|
||||
},
|
||||
op,
|
||||
t));
|
||||
}
|
||||
| K_IN
|
||||
( values=singleColumnInValues { conditions.emplace_back(
|
||||
binary_operator(
|
||||
subscript{
|
||||
key,
|
||||
element
|
||||
},
|
||||
oper_t::IN,
|
||||
collection_constructor{collection_constructor::style_type::list, values}));
|
||||
}
|
||||
| marker1=marker { conditions.emplace_back(
|
||||
binary_operator(
|
||||
subscript{
|
||||
key,
|
||||
element
|
||||
},
|
||||
oper_t::IN,
|
||||
marker1));
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user