LL parser framework represents parsers directly as EBNF grammars in inlined C++14
Questions tagged [boost-spirit-x3]
281 questions
0
votes
1 answer
spirit::x3 parser does move_to as std::string in test, but does it with Char in another app
I have the following test that works fine in a test app but in my big code it doesn't compile. What happens is that the parser is trying to hand me Char instead of a std::string. I've looked for any possible reason I would get different result, but,…

lakeweb
- 1,859
- 2
- 16
- 21
0
votes
1 answer
Boost.Spirit X3 -- operator minus does not work as expected
Consider the following code:
TEST_CASE("Requirements Parser Description", "[test]")
{
namespace x3 = ::boost::spirit::x3;
std::string s = "### Description\n\nSome\nmultiline\ntext."
"\n\n### Attributes";
std::string…

Markus W.
- 307
- 3
- 10
0
votes
1 answer
apply 'with<>' to a skipper parser to get context
My first version of this question was rich with misunderstandings. My answer below suits my needs. But I kept at it to understand what could be done with with<>. What I get is that it intended to inject context into a parser. Then the parser is…

lakeweb
- 1,859
- 2
- 16
- 21
0
votes
1 answer
Defining strict_real_policies for reals with a comma decimal character
I would like to create a custom policy derived from strict_real_policies that will parse reals, such as "3,14", i.e. with a comma decimal point as used e.g. in Germany.
That should be easy, right?

Niels Holst
- 586
- 4
- 9
0
votes
1 answer
Simple parsing to a tuple fails
Why does this not compile? The marked line gives me: "static assertion failed: The parser expects tuple-like attribute type". I would think that an std::tuple were the essence of "tuple-like"?
#include
#include
#include…

Niels Holst
- 586
- 4
- 9
0
votes
1 answer
Boost Spirit X3 parse grammar a^(2n+1)
I am using Boost Spirit X3 to parse some grammars but I encountered some errors which I can not explain. The code below is the simplified version of what I am trying to do.
#ifndef BOOST_SPIRIT_X3_NO_RTTI
#define…

mibu
- 1,303
- 11
- 14
0
votes
0 answers
Boost Spirit X3 Algebra Parser (With variables)
I've been writing a parser for algebraic expressions with spirit x3. My goal is to build upon the calc4c example parser so that it includes expressions with variables, exponents, and parentheses as a multiplication operator. I've been working on…

sheetkey
- 1
- 1
0
votes
0 answers
Assign value to a "global" variable from a lambda function
I'm using the boost spirit x3 semantic parser as lambda functions.
I would to like assign the value of string to an "external" variable, but my code doesn't work:
template
bool comment(Iterator first, Iterator last)
{
string…

Claudio La Rosa
- 141
- 1
- 2
- 7
0
votes
1 answer
Embedding a parser from a separate translation unit into another parser
I am trying to reuse a parser (named parser1_rule) that I have isolated in a translation unit (unit1.h/unit1.cpp), into another parser (name trace_parser). However I get a warning and an error message (reproduced and reformated below for easier…

Heyji
- 1,113
- 8
- 26
0
votes
0 answers
Boost spirit x3 - how to parse nested structures?
I try to parse
list fldName
I used the nested structures. But I have a trouble with parsing when one structure nested in other. Look at the sollowing minimal sample code:
#include
#include…

AeroSun
- 2,401
- 2
- 23
- 46
0
votes
1 answer
How do I change the code from this example
How can I change the code source to display the result?
I could not convert to boost spirit x3
Live Code
#include
#include
#include
#include
#include…

AlexY
- 11
- 1
0
votes
1 answer
Boost Spirit performance considerations (Date parsing)
I have been refactoring (while learning) some existing hand massaged date parsing routines with Boost Spirit. My main aim has been to try to do a single and unified interface to be able to parse dates represented in multiple different ways.…

Lauri
- 73
- 8
0
votes
1 answer
How to deal with Boost Spirit X3 causing a "static initialization order fiasco" in Visual Studio 2019?
I'm working on a nontrivial parser in C++ on top of boost::spirit::x3. I am splitting up my parsing code into logical units some of which are dependencies of each other. For example, one unit is an expression parser that also exposes an indentifier…

jwezorek
- 8,592
- 1
- 29
- 46
0
votes
1 answer
Parsing multiple CSS selectors with Boost Spirit X3
I am trying to parse multiple CSS selectors with Boost Spirit X3. If I have the following CSS rule that apply to multiple IDs (selectors) for example:
#ID1, #ID2, #ID3 { color:#000000; }
Where #ID1, #ID2, #ID3 are the selectors, color:#000000; is…

Jaime Ivan Cervantes
- 3,579
- 1
- 40
- 38
0
votes
1 answer
boost spirit x3 error handler with expectations
I want to create a parser using boost::spirit::x3 for line based files, e.g. every line has the same structure and can be repeated. Further I want some detailed error description in case there is an error. Finally it should be possible that the file…

Max
- 638
- 1
- 4
- 19