[antlr-interest] access to filename

Joep Suijs jsuijs at gmail.com
Sun May 2 23:28:15 PDT 2010


Hi Mark, Jim,


2010/5/3 Mark Wright <markwright at internode.on.net>:
> jalLexer *lexer;
> // Need to initialize lexer somehow
> printf("file name %s,",lexer->pLexer->input->fileName->chars);
>

Thank you for your suggestion, it prints the root file name. The
program also include subfiles with PUSHSTREAM macro, so tokens tokens
come from different files. I guess the tokens need to be the starting
point to get the appropriate filename...


@Jim
>> //      printf("input stream %d,",is->fileName);
> It is a pANTLR3_STRING, not a char *.

I don't understand how I can use it when even printing the value of
the pointer (is->fileName) fails. Please enlighten me.

Joep



More information about the antlr-interest mailing list