29#ifndef ATTRIBUTE_MAPPER_GRAMMAR_H
30#define ATTRIBUTE_MAPPER_GRAMMAR_H
32#include <boost/any.hpp>
33#include <boost/spirit/include/qi.hpp>
34#include <boost/spirit/include/qi_grammar.hpp>
35#include <boost/phoenix/operator.hpp>
36#include <boost/phoenix/object.hpp>
37#include <boost/phoenix/bind.hpp>
40namespace qi = boost::spirit::qi;
88 public qi::grammar<IteratorType>
95 = qi::lit(
"/*") >> *(qi::char_ - qi::lit(
"*/")) >> qi::lit(
"*/");
127template<
typename IteratorType,
typename Skipper>
class UAMGrammar :
128 public qi::grammar<IteratorType, ast::ast_tree(), Skipper>
145 using namespace qi::labels;
146 using boost::phoenix::construct;
147 using boost::phoenix::val;
148 using boost::spirit::qi::real_parser;
149 using boost::spirit::qi::strict_ureal_policies;
151 real_parser<float, strict_ureal_policies<float>> ureal;
175 = (lit(
"c:") >> attr(2)) | (lit(
"i:") >> attr(1)) | attr(0);
181 operand_rule =
"undefined" | (
"0x" > hex) | (ureal >>
'f') | uint_
205 | string(
"create_attributes")
206 | string(
"common_parent_type");
238 std::cout << val(
"Error! Expecting ") << _4
240 << construct<std::string>(_3,
242 << val(
"\"") << std::endl);
268 qi::rule<IteratorType, boost::optional<unsigned int>, Skipper>
Skipper grammer.
Definition: attribute_mapper_grammar.hpp:89
SkipperGrammar()
Definition: attribute_mapper_grammar.hpp:91
qi::rule< IteratorType > blockCommentRule
Definition: attribute_mapper_grammar.hpp:102
qi::rule< IteratorType > spaceRule
Definition: attribute_mapper_grammar.hpp:103
qi::rule< IteratorType > lineCommentRule
Definition: attribute_mapper_grammar.hpp:101
qi::rule< IteratorType > rule
Definition: attribute_mapper_grammar.hpp:104
Definition: attribute_mapper_grammar.hpp:129
qi::rule< IteratorType, ast::expression(), Skipper > term_rule
Definition: attribute_mapper_grammar.hpp:256
UAMGrammar()
Definition: attribute_mapper_grammar.hpp:131
qi::rule< IteratorType, int, Skipper > assignment_type_rule
Definition: attribute_mapper_grammar.hpp:259
qi::rule< IteratorType, boost::optional< unsigned int >, Skipper > scope_setting_value
Definition: attribute_mapper_grammar.hpp:269
qi::rule< IteratorType, ast::attribute(), Skipper > attribute_rule
Definition: attribute_mapper_grammar.hpp:260
qi::rule< IteratorType, ast::scope(), Skipper > scope_rule
Definition: attribute_mapper_grammar.hpp:272
qi::rule< IteratorType, ast::operand(), Skipper > operand_rule
Definition: attribute_mapper_grammar.hpp:257
qi::rule< IteratorType, std::string()> identifier_rule
Definition: attribute_mapper_grammar.hpp:263
qi::rule< IteratorType, Skipper > def_rule
Definition: attribute_mapper_grammar.hpp:273
qi::rule< IteratorType, ast::expression(), Skipper > expression_rule
Definition: attribute_mapper_grammar.hpp:255
defines_t defs
Definition: attribute_mapper_grammar.hpp:246
qi::rule< IteratorType, std::string()> scope_setting_name
Definition: attribute_mapper_grammar.hpp:267
qi::rule< IteratorType, ast::condition(), Skipper > condition_rule
Definition: attribute_mapper_grammar.hpp:258
qi::rule< IteratorType, ast::ast_tree(), Skipper > start_rule
Definition: attribute_mapper_grammar.hpp:274
qi::rule< IteratorType, ast::attribute_path_element(), Skipper > attribute_path_element_rule
Definition: attribute_mapper_grammar.hpp:262
qi::rule< IteratorType, ast::scope_setting(), Skipper > scope_configuration_rule
Definition: attribute_mapper_grammar.hpp:271
qi::rule< IteratorType, ast::function_invokation(), Skipper > built_in_function_rule
Definition: attribute_mapper_grammar.hpp:265
qi::rule< IteratorType, ast::assignment(), Skipper > assignment_rule
Definition: attribute_mapper_grammar.hpp:266
expr_rule_operators_ expr_rule_operators
term_rule_operators_ term_rule_operators
boost::variant< ast::nil, ast::operand, uint32_t, attribute_path_subscript > attribute_path_element
Attribute path element.
Definition: attribute_mapper_ast.hpp:104
@ operator_modulo
Definition: attribute_mapper_ast.hpp:72
@ operator_div
Definition: attribute_mapper_ast.hpp:65
@ operator_bitand
Definition: attribute_mapper_ast.hpp:66
@ operator_bitxor
Definition: attribute_mapper_ast.hpp:68
@ operator_minus
Definition: attribute_mapper_ast.hpp:62
@ operator_bitor
Definition: attribute_mapper_ast.hpp:67
@ operator_mult
Definition: attribute_mapper_ast.hpp:64
@ operator_or
Definition: attribute_mapper_ast.hpp:71
@ operator_less_than_or_eq
Definition: attribute_mapper_ast.hpp:75
@ operator_exponent
Definition: attribute_mapper_ast.hpp:73
@ operator_greater_than_or_eq
Definition: attribute_mapper_ast.hpp:76
@ operator_greater_than
Definition: attribute_mapper_ast.hpp:70
@ operator_plus
Definition: attribute_mapper_ast.hpp:61
@ operator_less_than
Definition: attribute_mapper_ast.hpp:69
@ operator_equals
Definition: attribute_mapper_ast.hpp:63
@ operator_neq
Definition: attribute_mapper_ast.hpp:74
x3::variant< ast::nil, uint32_t, float, x3::forward_ast< attribute >, x3::forward_ast< signed_ >, x3::forward_ast< expression >, x3::forward_ast< condition >, x3::forward_ast< function_invokation > > operand
Operands.
Definition: attribute_mapper_ast.hpp:95
sl_status_t add(zigbee_eui64_uint_t eui64, const zigpc_discovery_status_callback_t callback)
Add a callback to be invoked for a specific EUI64 (or WILDCARD_EUI64 for all devices).
Assignment.
Definition: attribute_mapper_ast.hpp:193
Definition: attribute_mapper_ast.hpp:53
Attribute.
Definition: attribute_mapper_ast.hpp:177
Condition.
Definition: attribute_mapper_ast.hpp:147
Expression.
Definition: attribute_mapper_ast.hpp:134
Built-in function invokation Example : fn_min_value(r'3, 5, d'5 or 20)
Definition: attribute_mapper_ast.hpp:209
Scope setting A scope setting consists of a setting name and an associated value.
Definition: attribute_mapper_ast.hpp:218
Scope.
Definition: attribute_mapper_ast.hpp:234
Definition: attribute_mapper_grammar.hpp:63
expr_rule_operators_()
Definition: attribute_mapper_grammar.hpp:64
Main UAM grammer.
Definition: attribute_mapper_grammar.hpp:123
static bool const expect_dot
Definition: attribute_mapper_grammar.hpp:124
Definition: attribute_mapper_grammar.hpp:45
term_rule_operators_()
Definition: attribute_mapper_grammar.hpp:46