After some research days, I figured out how to manage my problem.
Since my question did not receive much attention I guess my question was not formulated in an understandable way. Anyway, I am going to post the solution I found. I solved the problem in the lex file by following this tutorial.
Basically, I had to define a stack in order to save the current buffer state for the file that is currently being parsed when the include
statement is found, then I started to parse the included file, when the included file is finished I switched back to the first file.
I hope this answer may help someone around.