From 4b384ef705fedb0b1c47bee5b503988b2aaa679f Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Tue, 3 Mar 2015 09:13:56 +0200 Subject: [PATCH] cql3/Cql.g: Properties Signed-off-by: Pekka Enberg --- cql3/Cql.g | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/cql3/Cql.g b/cql3/Cql.g index 3f075ee375..e6646dd1b8 100644 --- a/cql3/Cql.g +++ b/cql3/Cql.g @@ -30,6 +30,7 @@ options { } @parser::includes { +#include "cql3/statements/property_definitions.hh" #include "cql3/statements/select_statement.hh" #include "cql3/statements/update_statement.hh" #include "cql3/statements/use_statement.hh" @@ -150,9 +151,9 @@ using operations_type = std::vectorsyntax_error(*this, msg); } + std::map convert_property_map(shared_ptr map) { + throw std::runtime_error("not implemented"); #if 0 - public Map convertPropertyMap(Maps.Literal map) - { if (map == null || map.entries == null || map.entries.isEmpty()) return Collections.emptyMap(); @@ -187,9 +188,9 @@ using operations_type = std::vector,::shared_ptr>>& operations, ::shared_ptr key, ::shared_ptr update) { @@ -1220,22 +1221,19 @@ columnCondition[conditions_type& conditions] ) ; -#if 0 - -properties[PropertyDefinitions props] +properties[::shared_ptr props] : property[props] (K_AND property[props])* ; -property[PropertyDefinitions props] - : k=ident '=' (simple=propertyValue { try { $props.addProperty(k.toString(), simple); } catch (SyntaxException e) { addRecognitionError(e.getMessage()); } } - | map=mapLiteral { try { $props.addProperty(k.toString(), convertPropertyMap(map)); } catch (SyntaxException e) { addRecognitionError(e.getMessage()); } }) +property[::shared_ptr props] + : k=ident '=' (simple=propertyValue { try { $props->add_property(k->to_string(), simple); } catch (exceptions::syntax_exception e) { add_recognition_error(e.what()); } } + | map=mapLiteral { try { $props->add_property(k->to_string(), convert_property_map(map)); } catch (exceptions::syntax_exception e) { add_recognition_error(e.what()); } }) ; -propertyValue returns [String str] - : c=constant { $str = c.getRawText(); } +propertyValue returns [sstring str] + : c=constant { $str = c->get_raw_text(); } | u=unreserved_keyword { $str = u; } ; -#endif relationType returns [const cql3::operator_type* op = nullptr] : '=' { $op = &cql3::operator_type::EQ; }