cql3/Cql.g: Properties

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
Pekka Enberg
2015-03-03 09:13:56 +02:00
parent 79caf1bc95
commit 4b384ef705

View File

@@ -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::vector<std::pair<::shared_ptr<cql3::column_identifi
listener->syntax_error(*this, msg);
}
std::map<sstring, sstring> convert_property_map(shared_ptr<cql3::maps::literal> map) {
throw std::runtime_error("not implemented");
#if 0
public Map<String, String> convertPropertyMap(Maps.Literal map)
{
if (map == null || map.entries == null || map.entries.isEmpty())
return Collections.<String, String>emptyMap();
@@ -187,9 +188,9 @@ using operations_type = std::vector<std::pair<::shared_ptr<cql3::column_identifi
}
return res;
#endif
}
#endif
void add_raw_update(std::vector<std::pair<::shared_ptr<cql3::column_identifier::raw>,::shared_ptr<cql3::operation::raw_update>>>& operations,
::shared_ptr<cql3::column_identifier::raw> key, ::shared_ptr<cql3::operation::raw_update> update)
{
@@ -1220,22 +1221,19 @@ columnCondition[conditions_type& conditions]
)
;
#if 0
properties[PropertyDefinitions props]
properties[::shared_ptr<cql3::statements::property_definitions> 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<cql3::statements::property_definitions> 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; }