Questions tagged [boost-spirit-karma]

Any question related to boost spirit generators, which are part of the karma sub-library of the spirit Library. It is the pending tag of boost-spirit-qi dedicated to parsers (as opposed to generators)

For more information, the best is to look at boost spirit documentation

karma is the part of the boost spirit Library dedicated to generators. Generators are objects used to format information to be printed, according to a predefined formatting rule (which could be called a grammar). In the boost spirit Library, generators are opposed to parsers, which are reading printed information according to a given grammar.

51 questions
2
votes
1 answer

spirit karma: access noncopyable pointer

I'm trying to access a vector of pointers in my karma grammar with little success. The pointer type is noncopyable, therefore the rule using it has to take a reference: #include #include…
ickby
  • 222
  • 1
  • 9
2
votes
1 answer

Boost Spirit Karma multiple optionals

I'm seeing an error that I'm not seeing the resolution to. First, the relevant code: namespace C { struct RangeEntry { size_t byte; boost::optional bit; }; struct Range { RangeEntry firstPart; …
2
votes
1 answer

boost spirit karma generating based on class inputs

Hi what i want is to generate some text according to what i pass into the generator for example struct C1 { int Getter() { return 3; } }; struct C2 { int Getter() { return 5; } }; template
2
votes
1 answer

boost::spirit::karma using the alternatives operator (|) with conditions

I'm trying to generate a string from my own class called Value using boost::spirit::karma, but i got stuck with this. I've tried to extract my problem into a simple example. I want to generate a String with karma from instances of the following…
Ingemar
  • 1,638
  • 2
  • 12
  • 15
1
vote
1 answer

How do I parse datetime with boost::karma/qi?

I'm parsing log file with following format: ,
Arsen Zahray
  • 24,367
  • 48
  • 131
  • 224
1
vote
1 answer

BOOST_FUSION_ADAPT_ADT explodes when using with boost::karma

I'm not sure if this is related to Error when adapting a class with BOOST_FUSION_ADAPT_ADT ,but even if it is, the question behind it is still not answered/still fails see the comment of the author Error when adapting a class with…
1
vote
1 answer

Passing delimiter to a child rule in boost spirit

This is in continuation of my question mentioned here Inconsistent Generator directive column behavior in boost karma I want to wrap that rule into another rule and when doing so , pass the column directive to the child rule but I cannot figure out…
user48833
  • 35
  • 4
1
vote
2 answers

How to display as many white spaces as characters in a symbol's mapped value in front of it

I honestly give up (like many other before me) to find by myself the syntax of this still pretty simple generator of the boost-spirit-karma Library. I would like to display, before the string, as many white spaces as characters in the string:…
Heyji
  • 1,113
  • 8
  • 26
1
vote
1 answer

What debugging technique for a karma generator with runtime error

Not easy to sate what my programming question is as I don't really see where the problem is. Indeed, I have a runtime error lost somewhere in the boost spirit karma Library. I guess I miss a debugging technique here. I have seen that the macro…
Heyji
  • 1,113
  • 8
  • 26
1
vote
1 answer

casting attribute to boost::variant

While learning how to use boost spirit, phoenix and fusion libraries, I came accross this minimal example that does not compile on msvc (2015, version 14) and boost 1.61.0 #include #include…
Heyji
  • 1,113
  • 8
  • 26
1
vote
1 answer

Boost Karma object method call

as an extension to my question and the answer from sehe i want to call a function while generating my output. I added the method bool isRoby() and modified the emp rule. #include #include…
Roby
  • 2,011
  • 4
  • 28
  • 55
1
vote
1 answer

boost karma semantic action call map

I need to map values to a std::string ( with the following map, and BOOST_FUSION_ADAPT_STRUCT ) std::map< TYPEX, std::string> author2name; struct Emp { std::string name; TYPEX author; }; With the following code i want to…
Roby
  • 2,011
  • 4
  • 28
  • 55
1
vote
1 answer

Spirit karma grammar issue when one rule uses BOOST_FUSION_ADAPT_STRUCT

I am trying to create a Spirit Karma grammar that is composed of several rules. This grammar is intended to create a string of the format "(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11)". The rule to print out each individual struct that I call RowData…
Enginerd
  • 21
  • 4
1
vote
1 answer

Using variant storing container in karma

boost::variant, std::string> tmp = "test"; std::string use; namespace karma = boost::spirit::karma; bool r = karma::generate(std::back_insert_iterator(use), +karma::int_ | *karma::char_, tmp); The result…
vipcxj
  • 840
  • 5
  • 10
1
vote
2 answers

Boost Spirit Karma - Output vector of strings with constraints and propagate failure?

I want to output a vector of strings using Boost Spirit Karma. The output generation should fail if any of the strings don't satisfy the constraints. I have tried the following: #include namespace ka =…
kloffy
  • 2,928
  • 2
  • 25
  • 34