Yunfeng ZHANG <zyf.zer...@gmail.com> writes: >> It took me a couple of minutes to understand what you meant here, so >> please let me re-phrase to make sure I got it. >> >> You are saying that the callback function of the cb_lex_token event is >> set by the callback function of the macro_start_expand event. >> >> Is that correct? > > Yes.
Thank you for making this clear. >> And this makes me wonder why you'd need the second parameter of >> macro_start_expand (the token). I believe you should have all the >> information you need with the first, second, and last parameter. As I >> said in my previous email, you can get the file offset of the token in >> your client code by doing 'file_offset = line + column'. So that token >> should not be needed. Thus, calling macro_start_expand from inside >> funlike_invocation_p once you are sure the expansion of the macro is >> going to take place, is possible. > > The only thing is the file-offset or source_location of the macro > leader token. To try to avoid confusion, I think what you call "source_location of the macro leader token" is actually the spelling location of the macro. > I don't know how to get it when macro_start_expand is called in > funlike_invocation_p intern. [...] > BTW, I can change my plugin to use line/column instead of fileoffset, there > ins't design limitation, only time. I think you can add a new source_location parameter to funlike_invocation_p function, and pass it the result->src_loc that you need. -- Dodji