Subject: [Boost-bugs] [Boost C++ Libraries] #7677: add_macro_definition("TEST=") behaves different than #define TEST
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-10 06:16:04
#7677: add_macro_definition("TEST=") behaves different than #define TEST
--------------------------------------+-------------------------------------
Reporter: klaus.guetter@⦠| Owner: hkaiser
Type: Bugs | Status: new
Milestone: To Be Determined | Component: wave
Version: Boost 1.52.0 | Severity: Problem
Keywords: |
--------------------------------------+-------------------------------------
Test1 posted below produces:
INT
SPACE
EOF
SPACE
IDENTIFIER
SEMICOLON
NEWLINE
EOF
While Test2 produces:
INT
SPACE
IDENTIFIER
SEMICOLON
NEWLINE
EOF
The EOF in the third line of Test1 output is produced by the TEST macro
expansion.
If this expected behaviour? I found this surprising.
(MSVC10, Boost 1.51)
----
Code:
{{{
typedef cpplexer::lex_token<> token_type;
typedef context<
string::iterator,
cpplexer::lex_iterator<token_type>
> lexer_context_type;
void Test1()
{
string instring("int TEST x;\n");
lexer_context_type ctx(instring.begin(), instring.end(), "");
ctx.set_language(language_support(support_c99));
ctx.add_macro_definition("TEST=");
for (lexer_context_type::iterator_type it = ctx.begin(); it !=
ctx.end(); ++it)
cout << get_token_name(token_id(*it)) << endl;
}
void Test2()
{
string instring("#define TEST\nint TEST x;\n");
lexer_context_type ctx(instring.begin(), instring.end(), "");
ctx.set_language(language_support(support_c99));
for (lexer_context_type::iterator_type it = ctx.begin(); it !=
ctx.end(); ++it)
cout << get_token_name(token_id(*it)) << endl;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7677> 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:11 UTC