diff --git a/cql3/Cql.g b/cql3/Cql.g index b8ec5c9ba7..68b1b63a4f 100644 --- a/cql3/Cql.g +++ b/cql3/Cql.g @@ -45,6 +45,7 @@ options { #include "cql3/cf_name.hh" #include "cql3/maps.hh" #include "cql3/sets.hh" +#include "cql3/lists.hh" #include "core/sstring.hh" #include "CqlLexer.hpp" @@ -1069,12 +1070,11 @@ setOrMapLiteral[shared_ptr t] returns [shared_ptr value] -#if 0 - : '[' { List l = new ArrayList(); } - ( t1=term { l.add(t1); } ( ',' tn=term { l.add(tn); } )* )? - ']' { $value = new Lists.Literal(l); } -#endif // turn ':' below to '|': - : '{' t=term v=setOrMapLiteral[t] { $value = v; } '}' + @init{ std::vector> l; } + : '[' + ( t1=term { l.push_back(t1); } ( ',' tn=term { l.push_back(tn); } )* )? + ']' { $value = ::make_shared(std::move(l)); } + | '{' t=term v=setOrMapLiteral[t] { $value = v; } '}' // Note that we have an ambiguity between maps and set for "{}". So we force it to a set literal, // and deal with it later based on the type of the column (SetLiteral.java). | '{' '}' { $value = make_shared(cql3::sets::literal({})); }