Questions tagged [boost-spirit-x3]

LL parser framework represents parsers directly as EBNF grammars in inlined C++14

281 questions
1
vote
1 answer

Spirit X3, two rules do not compile after being combined into one

I am currently learning how to use x3. As the title states, I have had success creating a grammar with a few simple rules, but upon combining two of these rules into one, the code no longer compiles. Here is the code for the AST portion: namespace…
CompileYourCake
  • 324
  • 2
  • 12
1
vote
1 answer

Boost spirit x3 parse into struct with skipping member if it empty

I'm trying to figure out the way of parsing the following texts function() {body ...} function(args_) {body...} Should i use the same struct for both variants or it could be done with only one struct struct function { std::string name_; …
1
vote
1 answer

Are boost spirit V2 Qi grammars thread safe?

While reading the boost spirit V2 docs, this SO-question and this top google spirit doc result for spirit classic/v1 I was not able to find any statement on the thread safety of boost spirit V2 grammars and rules. Some are claiming it's not like in…
Superlokkus
  • 4,731
  • 1
  • 25
  • 57
1
vote
1 answer

Compiler errors when parsing into x3::variant

I´m doing more or less my first steps with X3 and already managed to parse a simple struct with 2 members. But I fail to put this struct into a variant. The (simplified) code looks something like this: struct Command1 { CommandType…
Michael G.
  • 13
  • 2
1
vote
1 answer

Simple Spirit X3 word splitter won't compile, attribute mismatch

I'm trying to use a Spirit X3 parser to process the output from a command-line tool, but have been having issues. I've narrowed them down to a minimal example whose behaviour I don't understand: #include #include #include…
Quentin
  • 62,093
  • 7
  • 131
  • 191
1
vote
1 answer

Boost Spirit x3 parsing into a struct with single field

Im keep invistigate boost spirit examples, and collided with the following problem. (i think it was described somwhere like a bug in the code, but i may be wrong) Simply: Parser didn build when try to pars into a struct with a single filed of type…
1
vote
1 answer

Boost spirit x3 example calculator (calc8, calc9) linker error

I'm very new with boost spirit (and with boost). Its very interesting library. I use qtcreator + MinGW 5.3. I simply add every source file from git_hub_calc8 into new project and add some boost library, but i got the following error trying to build…
1
vote
1 answer

boost spirit x3 tuple construction and implicit unused_type

Reading the documentation, I think the below should work correctly, but instead it fails to compile unless I don't pass output to the phrase_parse call, in which case it works correctly, though I can't get the data I want. It seems that nvp_def has…
byteit101
  • 3,910
  • 2
  • 20
  • 29
1
vote
1 answer

Spirit.X3 : using push_back_container traits with list parser

I have a class having public ctor and some add() method: class object { object() {} template void add(T&& val) { // some adding here} } The main question I'm faced is how can I adopt spirit.x3 list parser to use object::add()…
drus
  • 495
  • 2
  • 6
  • 13
1
vote
1 answer

boost::spirit::x3 parsing is slower than strsep parsing

I wrote a x3 parser to parse a structured text file, here is the demo code: int main() { char buf[10240]; type_t example; // def see below FILE* fp = fopen("text", "r"); while (fgets(buf, 10240, fp)) // read to the…
avocado
  • 2,615
  • 3
  • 24
  • 43
1
vote
2 answers

Boost.Spirit X3 Alternative Operator

I have the following code: #include #include struct printer { template void operator()(std::vector &vec) { std::cout << "vec("…
kalaxy
  • 1,608
  • 1
  • 14
  • 14
1
vote
1 answer

Spirit.X3 using string_view and member named 'insert' compiler error

At Stackoverflow there are several Questions & Answers which are related to use {boost, std}::string_view, e.g.: parsing from std::string into a boost::string_view using boost::spirit::x3 with overloading x3's move_to namespace boost { namespace…
Olx
  • 163
  • 8
1
vote
1 answer

parse kleene operator to a set of alternatives, adaptor? with spirit x3

I've learned a lot in the last couple of weeks about this stuff, but not enough. The code below compiles and runs but the code in TEST_ADAPT is incomplete, I'm not sure how to make the connection. The object is to parse into a plane jane container…
lakeweb
  • 1,859
  • 2
  • 16
  • 21
1
vote
1 answer

Combining rules at runtime and returning rules

I am trying to write some complex parser made on top of Spirit-X3, so I need to know some things: ♦ How to combine rules at runtime. (with Nabialek's trick) ♦ Is it ok to return rules like this: x3::rule SomeFunction(std::string &str) { …
NotMe
  • 97
  • 7
1
vote
1 answer

Dynamically switching symbol tables in x3

Given the following x3 grammar that parses correctly, I want to add validation of parameters, qualifiers, and properties. This would seem to indicate some method of dynamically switching which symbol table is being used within the various rules.…
Brian
  • 305
  • 1
  • 11