[antlr-interest] Wrapping input files to process multiple sources

Rodrigo Baptista digobaptista at gmail.com
Sun May 28 12:06:23 PDT 2006


Hi Micheal,

Thank you for your help! I already checked that sample and I tried to
integrate on my compiler but it seems that something is wrong because the
selector.retry() is throwing TokenStreamRetryException in both places
(uponEOF() method and at INCLUDE production) is it normal?

Im using Visual Studio 2005 and when I run the compiler, VS warns me telling
that the TokenStreamRetryException was thrown 2 times but if I continue with
the compilation it runs fine (it access the included file). Although if I
catch the TokenStreamRetryException for example:

try
{
         selector.retry();
}
catch (TokenStreamRetryException e)
{
         Console.WriteLine(e.Message);
}

It prints the message but it doesnt access to the included file.

Is something that Im missing?

Cheers,

Rodrigo

On 5/24/06, Micheal J <open.zone at virgin.net> wrote:
>
>  Hi Rodrigo,
>
> See the includeFile sample included with ANTLR.
>
> Cheers,
>
> Micheal
>
>
>  -----Original Message-----
> *From:* antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org]
> *On Behalf Of *Rodrigo Baptista
> *Sent:* 24 May 2006 13:06
> *To:* antlr-interest at antlr.org
> *Subject:* [antlr-interest] Wrapping input files to process multiple
> sources
>
> Hello again and sorry for being repeated but i suppose that people from
> the mailing list thought that someone already answered to my question
> because Loring Craymer posted his question on my thread and so on, but
> unfortunetly not.
>
> Im using ANTLR to generate a compiler in C# for a DSL and I would like to
> know how to pass to the Lexer multiple input files (something similar to the
> control of "yyin" using "yywrap()" in flex) in order to be able to switch
> the source stream.
>
> I know that I could concatenate all the input files in a stream and pass
> it to the Lexer but I still want to know if ANTLR has some tool to prevent
> this option.
>
> This is a typical way to process "<include/import xpto>" files.
>
> Regards,
>
> Rodrigo
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060528/fde2560c/attachment.html


More information about the antlr-interest mailing list