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_bind.hpp>
27 namespace SDDS {
namespace parser
29 template <
typename Iterator>
30 data_parser<Iterator>::data_parser(error_handler<Iterator> & _error_handler):
31 data_parser::base_type(start)
36 typedef function<error_handler<Iterator> > error_handler_function;
43 qi::short_type short_;
57 data_mode = lit(
"mode") >
'=' >
datamode;
58 data_lines = lit(
"lines_per_row") >
'=' > long_;
59 data_row = lit(
"no_row_counts") >
'=' > long_;
60 data_fixed = lit(
"fixed_row_count") >
'=' > long_;
61 data_additional = lit(
"additional_header_lines") >
'=' > long_;
62 data_column = lit(
"column_major_order") >
'=' > short_;
63 data_endian = lit(
"endian") >
'=' > dataendian;
65 auto complainLines = phx::bind(&data::complainUnsupported<data::LINES_PER_ROW>::apply);
66 auto complainFixed = phx::bind(&data::complainUnsupported<data::FIXED_ROW_COUNT>::apply);
67 auto complainAdditional = phx::bind(&data::complainUnsupported<data::ADDITIONAL_HEADER_LINES>::apply);
68 auto complainColumn = phx::bind(&data::complainUnsupported<data::COLUMN_MAJOR_ORDER>::apply);
69 auto complainEndian = phx::bind(&data::complainUnsupported<data::ENDIAN>::apply);
71 data_unsupported_pre =
72 ((
',' > data_lines[_pass = complainLines])
73 ^ (
',' > data_fixed[_pass = complainFixed])
74 ^ (
',' > data_additional[_pass = complainAdditional])
75 ^ (
',' > data_column[_pass = complainColumn])
76 ^ (
',' > data_endian[_pass = complainEndian]));
77 data_unsupported_post =
78 ((data_lines[_pass = complainLines] >
',')
79 ^ (data_fixed[_pass = complainFixed] >
',')
80 ^ (data_additional[_pass = complainAdditional] >
',')
81 ^ (data_column[_pass = complainColumn] >
',')
82 ^ (data_endian[_pass = complainEndian] >
','));
86 > -data_unsupported_post
87 > ((data_mode[phx::at_c<0>(_val) = _1] >>
',' >> data_row[phx::at_c<1>(_val) = _1])
88 | (data_row[phx::at_c<1>(_val) = _1] >>
',' >> data_mode[phx::at_c<0>(_val) = _1]))
89 > -data_unsupported_pre
91 >> eps[_pass = phx::bind(&data::isASCII, _val)];
93 BOOST_SPIRIT_DEBUG_NODES(
98 error_handler_function(_error_handler)(
99 std::string(
"Error! Expecting "), _4, _3));