[antlr-interest] How to judge the begin of current file?

Terence Parr parrt at jguru.com
Sat Oct 26 09:51:21 PDT 2002


On Friday, October 25, 2002, at 10:31  PM, QinPeng wrote:

> Hi,all!
>  
> When a file test.h is:
> #include "test1.h"
> unsigned int usTest;
>  
> the test1.h is:
>  
> unsigned int usTest;
>  
> and use lexer to construct a parer tree of test.h and test1.h,
> but how can I judge where is the begin of test.h of the parer tree sine
> the parer tree is begin at test1.h?

Hi.  Well, the problem is that there is no token at the start of test.h 
for you to record the filename, right?  Perhaps you don't need to know 
that.  Just record that usTest is the first declaration of test.h.  If 
you can explain more about what you are doing, I might think of 
something.

Terence
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list