/* openDCM, dimensional constraint manager Copyright (C) 2013 Stefan Troeger This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef DCM_PARSER_IMP_H #define DCM_PARSER_IMP_H #include #include "opendcm/core/system.hpp" #include #include #include BOOST_FUSION_ADAPT_TPL_STRUCT( (T1)(T2)(T3)(T4), (dcm::ClusterGraph) (T1)(T2)(T3)(T4), (typename dcm::details::pts::type, m_properties)) #include "parser.hpp" namespace boost { namespace spirit { namespace traits { template struct transform_attribute*, dcm::ClusterGraph, qi::domain> { typedef dcm::ClusterGraph& type; static type pre(dcm::ClusterGraph* const& val) { return *val; } static void post(dcm::ClusterGraph* const& val, dcm::ClusterGraph const& attr) {} static void fail(dcm::ClusterGraph* const&) {} }; }}} namespace dcm { typedef boost::spirit::istream_iterator IIterator; template parser::parser() : parser::base_type(cluster) { cluster %= qi::lit("" >> -(qi::eps( qi::_a > 0 )[qi::_val = phx::new_()]) >> qi::eps[phx::bind(&Sys::Cluster::setCopyMode, qi::_val, true)] >> qi::eps[phx::bind(&Injector::setVertexProperty, &in, qi::_val, qi::_a)] >> qi::attr_cast(cluster_prop >> qi::eps) >> qi::omit[(*cluster(qi::_r1))[qi::_b = qi::_1]] >> qi::omit[*vertex(qi::_val, qi::_r1)] >> qi::omit[*edge(qi::_val, qi::_r1)] >> qi::eps[phx::bind(&Injector::addClusters, &in, qi::_b, qi::_val)] >> qi::eps[phx::bind(&Sys::Cluster::setCopyMode, qi::_val, false)] >> "";// >> str[&sp::print]; }; } #endif //DCM_PARSER_H