17#ifndef PARAMETER_DEF_HPP_
18#define PARAMETER_DEF_HPP_
22#include <boost/spirit/include/phoenix_core.hpp>
23#include <boost/spirit/include/phoenix_operator.hpp>
24#include <boost/spirit/include/phoenix_fusion.hpp>
25#include <boost/spirit/include/phoenix_object.hpp>
26#include <boost/spirit/include/phoenix_bind.hpp>
28namespace SDDS {
namespace parser
30 template <
typename Iterator>
31 parameter_parser<Iterator>::parameter_parser(error_handler<Iterator> & _error_handler):
32 parameter_parser::base_type(start)
38 typedef function<error_handler<Iterator> > error_handler_function;
44 qi::lexeme_type lexeme;
54 quoted_string %= lexeme[
'"' >> +(char_ -
'"') >>
'"'];
55 string %= quoted_string
56 | lexeme[(
alpha | char_(
"@:#+-%._$&/")) >> *(alnum | char_(
"@:#+-%._$&/"))];
57 units %= lexeme[
alpha >> *(
alpha | char_(
'/'))]
69 parameter_name = lit(
"name") >
'=' > string;
70 parameter_units %= lit(
"units") >
'=' > units;
71 parameter_description %= lit(
"description") >
'=' > string;
72 parameter_type %= lit(
"type") >
'=' >
datatype;
73 parameter_symbol = lit(
"symbol") >
'=' > string;
74 parameter_format = lit(
"format_string") >
'=' > string;
75 parameter_fixed = lit(
"fixed_value") > long_;
77 auto complainSymbol = phx::bind(¶meter::complainUnsupported<parameter::SYMBOL>::apply);
78 auto complainFormat = phx::bind(¶meter::complainUnsupported<parameter::FORMAT_STRING>::apply);
79 auto complainFixed = phx::bind(¶meter::complainUnsupported<parameter::FIXED_VALUE>::apply);
81 parameter_unsupported_pre =
82 ((
',' > parameter_symbol[_pass = complainSymbol])
83 ^ (
',' > parameter_format[_pass = complainFormat])
84 ^ (
',' > parameter_fixed[_pass = complainFixed])
86 parameter_unsupported_post =
87 ((parameter_symbol[_pass = complainSymbol] >
',')
88 ^ (parameter_format[_pass = complainFormat] >
',')
89 ^ (parameter_fixed[_pass = complainFixed] >
',')
94 > -parameter_unsupported_post
95 >> ((parameter_name[phx::at_c<0>(_val) = _1]
96 >> ((
',' >> parameter_type[phx::at_c<1>(_val) = _1])
97 ^(
',' >> parameter_units[phx::at_c<2>(_val) = _1])
98 ^(
',' >> parameter_description[phx::at_c<3>(_val) = _1])
100 |(parameter_type[phx::at_c<1>(_val) = _1]
101 >> ((
',' >> parameter_name[phx::at_c<0>(_val) = _1])
102 ^(
',' >> parameter_units[phx::at_c<2>(_val) = _1])
103 ^(
',' >> parameter_description[phx::at_c<3>(_val) = _1])
105 |(parameter_units[phx::at_c<2>(_val) = _1]
106 >> ((
',' >> parameter_type[phx::at_c<1>(_val) = _1])
107 ^(
',' >> parameter_name[phx::at_c<0>(_val) = _1])
108 ^(
',' >> parameter_description[phx::at_c<3>(_val) = _1])
110 |(parameter_description[phx::at_c<3>(_val) = _1]
111 >> ((
',' >> parameter_type[phx::at_c<1>(_val) = _1])
112 ^(
',' >> parameter_units[phx::at_c<2>(_val) = _1])
113 ^(
',' >> parameter_name[phx::at_c<0>(_val) = _1])
116 > -parameter_unsupported_pre
118 >> eps[_pass = phx::bind(¶meter::checkMandatories, _val)];
120 BOOST_SPIRIT_DEBUG_NODES(
124 on_error<fail>(start,
125 error_handler_function(_error_handler)(
126 std::string(
"Error! Expecting "), _4, _3));
py::list function(PolynomialPatch *patch, py::list point)
constexpr double alpha
The fine structure constant, no dimension.