Questions tagged [boost-phoenix]

Boost.Phoenix is a C++ library to enable function programming in C++.

159 questions
1
vote
1 answer

Boost::Spirit placeholders and alternative parser

// 1 Mexpression = Mterm >> *( '+' >> Mterm [qi::_val = phoenix::new_(_1, '+', _2)] | '-' >> Mterm [qi::_val = phoenix::new_(_1, '-', _2)] ); Mterm = Mfactor >> *( '*' >> Mfactor [qi::_val =…
1
vote
1 answer

Boost spirit parser not compiling

I tried to write a simple expression parser with boost::spirit. I started with the calculator example (see: http://www.boost.org/doc/libs/1_41_0/libs/spirit/example/qi/calc2_ast.cpp) and tried to add a "ref" rule denoting a reference to a variable.…
gexicide
  • 38,535
  • 21
  • 92
  • 152
1
vote
2 answers

Problems adapting member functions in Phoenix

I use BOOST_PHOENIX_ADAPT_FUNCTION all the time in Spirit. I'd like to be able to adapt member functions for all of the same reason. However, I get compile errors if I do something like this: struct A { int foo(int i) { return 5*i;…
user2913094
  • 981
  • 9
  • 16
1
vote
1 answer

Problems with boost::phoenix::bind and boost::phoenix::actors in a semantic action for boost::spirit::qi

I think I am having an issue understanding how my boost::spirit::qi parser is supposed to be written. I simply want to pass matched substrings to functions via semantic actions. In an attempt to roughly emulate this boost tutorial, I have come up…
Suedocode
  • 2,504
  • 3
  • 23
  • 41
1
vote
1 answer

Simple expression with boost::spirit

I need to parse simple_expression ::= limit int_number (days | hours | minutes). I wrote code for grammar struct Parser: grammar { public: Parser(ConditionTree& a_lTree): …
adil
  • 45
  • 5
1
vote
1 answer

What's wrong with my Boost Phoenix lambda?

I consider that Phoenix lambda functions is somehow C++11 lambda. So I try the following: http://coliru.stacked-crooked.com/a/38f1a2b655ea70fc #include #include #include using namespace std; using namespace…
tower120
  • 5,007
  • 6
  • 40
  • 88
1
vote
1 answer

Boost spirit revert parsing

I want to parse a file containing the following structure: some garbage *&% section1 { section_content } section2 { section_content } The rule parsing section_name1 { ... } section_name2 { ... } is already defined: section_name_rule =…
haykart
  • 957
  • 5
  • 14
  • 34
1
vote
1 answer

map of boost phoenix new_?

I have the following factory function: std::auto_ptr PathFactory(std::string const& branch_type, CPathModel const& path_model) { using namespace boost::assign; using namespace boost::phoenix::placeholders; typedef…
void.pointer
  • 24,859
  • 31
  • 132
  • 243
1
vote
1 answer

comma behaviour seems incorrect in boost::phoenix

given a phoenix code [a(),b()], I think the correct behavior is called a() then b() respectively, but obviously in boost 1.47 only second function is called, this is what it is supposed to be? see the below code: struct employee_parser :…
Rui Zhou
  • 209
  • 1
  • 3
  • 9
1
vote
1 answer

Fusion vector projection

I have a fusion vector with elements which have several member data of different types and I would like to create a new fusion vector(s) that will project just specific data member(s). I've been looking into this for some time already but no…
G. Civardi
  • 667
  • 5
  • 12
1
vote
2 answers

boost::phoenix error message while used as a functor

I am trying to learn boost::phoenix and trying to use it in std::transform like below. class myClass { int i; public: getNumber(); setNumber(int j); }; int main() { std::vector vect std::vector numVect …
polapts
  • 5,493
  • 10
  • 37
  • 49
1
vote
1 answer

How to avoid boost::phoenix when generating with boost::spirit::karma

I'm a victim of error "LNK1179: invalid or corrupt file: duplicate COMDAT" and these sources lead me to believe that by not using phoenix I could avoid this error. (This is a follow-up to my previous question.) I want to replace boost::phoenix with…
foraidt
  • 5,519
  • 5
  • 52
  • 80
1
vote
1 answer

Cannot get simplest Phoenix lambda to compile

I am currently trying to get the following very simple boost::phoenix::lambda to compile: #include #include int main() { boost::phoenix::lambda[std::cout << "Lambda!!"](); } However, this generates a host…
Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
1
vote
1 answer

BOOST_PHOENIX_ADAPT_FUNCTION causes invalid template error

I am trying to create a lazy function from a template function following the Boost::phoenix documentation. The code looks like this #include #include #include #include…
1
vote
1 answer

Create a phoenix function for use in spirit rule

I'm trying to make the code below compile, but, as usual, errors with spirit/phoenix gives not a lot a clues about what is wrong. Can anyone see what the problem is ? #include #include…
neodelphi
  • 2,706
  • 1
  • 15
  • 22