Questions tagged [boost-spirit-lex]
60 questions
1
vote
0 answers
boost spirit lexer on a stream does not tokenize "early" enough (too much lookahead?)
I'm using a boost::spirit::lex lexer to tokenize an input stream, using spirit::istream_iterators as described in Using Boost.Spirit.Lex and stream iterators .
My problem is that lex::tokenize does not seem to output a token as "early" (along the…

nfomon
- 43
- 4
1
vote
0 answers
Different types of semantic actions in Boost Spirit Lex
Can Boost's Spirit Lex have multiple semantic actions for a token definition?
Consider this Lexer construction:
namespace bp = boost::phoenix;
this->self = lex::token_def<>("[ \v\f\t\r]+")
| lex::token_def<>("\n")[++bp::ref(line_no)]
|…

SiimKallas
- 934
- 11
- 23
1
vote
1 answer
Boost::spirit illegal_backtracking exception
I use Boost.Spirit.Lex and .Qi for a simple calculator project and (as usual) it gives me some pain to debug and use. The debug prints:
boost::spirit::multi_pass::illegal_backtracking
This exception is thrown and I can't…

Pierre T.
- 380
- 1
- 13
1
vote
1 answer
Boost::Spirit::Lex; How do I specify the token "||"?
So my question is quite simple, in my lexer class (extending lex::lexer), I have the following;
this->self.add
...
("&&", AND_AND)
("||", OR_OR)
...
Inside my constructor, which compiles just fine, but triggers a SegFault on…

Skeen
- 4,614
- 5
- 41
- 67
1
vote
1 answer
Parsing a tokenized free form grammar with Boost.Spirit
I've got stuck trying to create a Boost.Spirit parser for the callgrind tool's output which is part of valgrind. Callgrind outputs a domain specific embedded programming language (DSEL) which lets you do all sorts of cool stuff like custom…

Niall Douglas
- 9,212
- 2
- 44
- 54
1
vote
1 answer
How to ignore a token attribute from spirit::Lex when using spirit::qi?
When I use this qi grammar accepting tokens from Lex:
pair %= token(ID_MARKER)
>> ':'
>> atom
>> ','
>> atom
;
in conjunction with this fusion/tuple mapping to assist in the capture:
BOOST_FUSION_ADAPT_STRUCT(
…

kfmfe04
- 14,936
- 14
- 74
- 140
1
vote
1 answer
why does this boost::spirit::qi rule not work?
I have a grammar that defines the following rules:
constantValue = qi::token(ID_FLOAT) | qi::token(ID_INTEGER);
postfixExpression = primaryExpression |
(postfixExpression >> qi::token(ID_OPENBRACKET) >> qi::token(ID_INTEGER) >>…

Tobias Langner
- 10,634
- 6
- 46
- 76
1
vote
1 answer
Internal compiler error with Boost.Spirit
I'm trying to compile the following seemingly simple code using GCC 3.4.6 and Boost 1.43 and it's generating an internal compiler error:
#include
#include
#include…

Haitham Gad
- 1,529
- 2
- 13
- 23
1
vote
1 answer
Attribute compatibility not disabled by semantic actions
I have a grammar rule that looks like this:
rule expr, factor;
expr =
(
+(
(
toks.symbol // toks.symbol attribute type is an std::string
[
// I'm trying to force…

Haitham Gad
- 1,529
- 2
- 13
- 23
0
votes
1 answer
Need help with lexer runtime_error
I'm trying to write a C qi parser for a modified C language. When I un-comment the t_in_op and below section I get a run_time error stating
Syntax Error: Hit BEGIN when '+' at index 1 (or something along those lines, don't remember exactly). What is…

Uday
- 150
- 1
- 5
0
votes
1 answer
Boost.Spirit(2) Lex: strip_comments_lexer.cpp - not work?
boost_1_47_0/libs/spirit/example/lex/strip_comments_lexer.cpp
Not strip C-style comments.
Why?

knkd
- 75
- 2
- 7
0
votes
1 answer
Converting a Boost actor_lexer to static: Error as if "actor_" not used
I'm converting a Boost Spirit Lex program to the static lexer model. The lexer has a semantic action, therefore the dynamic lexer is of type actor_lexer:
#ifndef USE_STATIC_SI_LEXER
typedef lex::lexertl::actor_lexer…

Felix Dombek
- 13,664
- 17
- 79
- 131
0
votes
1 answer
Boost spirit how check value of token?
How I can check in next code that value of last tok.identifier is '='-character?
parameter = (
tok.identifier
>> ((lit(":")
>> tok.identifier) |
(tok.identifier >>…

Viola
- 23
- 7
0
votes
1 answer
C++ boost::spirit lexer regex
I'm doing a simple lexer/parser with boost::spirit.
This is the lexer :
template
struct word_count_tokens : lex::lexer
{
word_count_tokens()
{ …
user1746732
0
votes
0 answers
Parsing a peculiar unary minus sign using Spirit.Lex
I'm trying to parse a language where a unary minus is distinguished from a binary minus by the whitespaces existing around the sign. Below are some pseudo rules defining how the minus sign is interpreted in this language:
-x // unary
x - y …

Haitham Gad
- 1,529
- 2
- 13
- 23