37 #ifndef NEKTAR_LIBUTILITIES_PARSEUTILS_HPP
38 #define NEKTAR_LIBUTILITIES_PARSEUTILS_HPP
43 #include <boost/version.hpp>
45 #if( BOOST_VERSION / 100 % 1000 >= 36 )
46 #include <boost/spirit/include/classic_core.hpp>
47 #include <boost/spirit/include/classic_push_back_actor.hpp>
49 using namespace boost::spirit::classic;
51 #include <boost/spirit/core.hpp>
52 #include <boost/spirit/actor/push_back_actor.hpp>
54 using namespace boost::spirit;
62 static bool ParseRealAssignment(
const char *
const str, std::string &symbol,
NekDouble &value)
70 lexeme_d[alpha_p >> *alnum_p][symbolFunctor] >>
"=" >> real_p[valueFunctor]
78 static bool GenerateSeqVector(
const char *
const str, std::vector<unsigned int> &vec)
87 uint_p[functor1] >> !(
'-' >> uint_p[functor2]) >>
88 *(
',' >> uint_p[functor1] >> !(
'-' >> uint_p[functor2]))
96 static bool GenerateOrderedVector(
const char *
const str, std::vector<unsigned int> &vec)
104 uint_p[functor1] >> *(
',' >> uint_p[functor1])
112 static bool GenerateOrderedVector(
const char *
const str, std::vector<NekDouble> &vec)
120 real_p[functor4] >> *(
',' >> real_p[functor4])
127 static bool GenerateUnOrderedVector(
const char *
const str, std::vector<NekDouble> &vec)
135 real_p[functor5] >> *(
',' >> real_p[functor5])
142 static bool GenerateOrderedStringVector(
const char *
const str, std::vector<std::string> &vec)
150 (+(print_p -
','))[functor3] >> *(
',' >> (+(print_p -
','))[functor3])
167 void operator()(
const char *beg,
const char *end)
const
169 m_symbol->assign(beg, end-beg);
199 void operator()(
unsigned int n)
const
201 #ifdef NOTREQUIRED //SJS: I do not think we need this check
202 if (!m_vector->empty())
204 unsigned int prevElem = m_vector->back();
208 m_vector->push_back(n);
214 m_vector->push_back(n);
230 void operator()(
unsigned int n)
const
232 unsigned int prevElem = m_vector->back();
234 for (
unsigned int i=prevElem+1; i<=n; ++i)
236 m_vector->push_back(i);
251 void operator()(
char const* first,
char const* last)
const
253 m_vector->push_back(std::string(first, last));
270 if (!m_vector->empty())
276 m_vector->push_back(n);
281 m_vector->push_back(n);
299 m_vector->push_back(n);
310 #endif //NEKTAR_LIBUTILITIES_PARSEUTILS_HPP