How can I use flex lexer in C++ and modify a token's yytext value?
Lets say, I have a rule like this:
"/*"    {
        char c;
        while(true)
            {
            c = yyinput();
            if(c == '\n')
                ++mylineno;
            if (c==EOF){
                yyerror( "EOF occured while processing comment" );
                break;
            }
            else if(c == '*')
                {
                if((c = yyinput()) == '/'){
                    return(tokens::COMMENT);}
                else
                    unput(c);
                }
            }
        }
And I want to get token tokens::COMMENT with value of comment between /* and */.
(The bove solution gives "/*" as the value.
Additional, very important is tracking the line number, so I'm looking for solution supporting it.
EDIT
Of course I can modify the yytext and yyleng values (like yytext+=1; yyleng-=1, but still I cannot solve the above problem)