Boost logo

Boost :

Subject: Re: [boost] [wave] add_macro_definition("TEST=") behaves different than #define TEST
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2012-11-09 11:00:41


> 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)

Looks like a bug to me. Would you mind creating a ticket for this, please?

Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu

>
> Regards, Klaus
>
> ----
> 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;
> }
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk