Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11327: boost::wave produces non-existent tokens
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-21 22:54:17
#11327: boost::wave produces non-existent tokens
----------------------------------+---------------------
Reporter: Vyacheslav Andrejev | Owner: hkaiser
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: wave
Version: Boost 1.57.0 | Severity: Problem
Resolution: invalid | Keywords:
----------------------------------+---------------------
Comment (by Vyacheslav Andrejev):
Actually enable_emit_line_directives has undesired effect: the lexer not
only stops producing not existing `#line`, but also removes existing. For
example
{{{#!cpp
#include <iostream>
#include <string>
#include <boost/wave.hpp>
#include <boost/wave/cpplexer/cpp_lex_iterator.hpp>
using namespace boost::wave;
using namespace boost::wave::cpplexer;
int main(int argc, char* argv[])
{
std::string str = "int a;\n#line 10 \"file.cpp\"\nint b;\n";
typedef lex_iterator<lex_token<> > LexIterator;
typedef boost::wave::context<std::string::const_iterator, LexIterator>
WaveContext;
WaveContext ctx(str.cbegin(), str.cend());
ctx.set_language(
boost::wave::enable_emit_line_directives(
ctx.get_language(),
false));
for (auto tok : ctx)
{
std::cout << get_token_name(token_id(tok)) << '('
<< tok.get_value() << ')' << std::endl;
}
return 0;
}
}}}
The output:
{{{
INT(int)
SPACE( )
IDENTIFIER(a)
SEMICOLON(;)
NEWLINE(
)
INT(int)
SPACE( )
IDENTIFIER(b)
SEMICOLON(;)
NEWLINE(
)
EOF()
}}}
Is there a way to leave just existing `#line`?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11327#comment:3> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC