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

Rodrigo Baptista digobaptista at gmail.com
Mon May 29 04:10:27 PDT 2006


Michael

I didnt tried the includeFile example itself, I just adapted the grammar
from my compiler to support the inclusion of files. I dont understand the
reason that retry() method throws TokenStreamRetryException nevertheless it
works fine, but I still want to clean up my code.

Rodrigo

On 5/28/06, Micheal J <open.zone at virgin.net> wrote:
>
>  Rodrigo,
>
> Are you saying the the includeFile example doesn't work for you?. I
> haven't had any issues [reported] to that effect. I just tried it again and
> it seems to work just fine.
>
> If you have Nant properly installed (and the .NET SDK), it probably best
> to just type "nant" from the directory containing the example.
>
> Just in case you're not, ANTLR V2 sometimes often raises exceptions fo
> non-exceptional cases. So yes, it's normal for ANTLR V2.
>
> Micheal
>
>
>  -----Original Message-----
> *From:* antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org]
> *On Behalf Of *Rodrigo Baptista
> *Sent:* 28 May 2006 20:06
> *To:* antlr-interest at antlr.org
> *Subject:* Re: [antlr-interest] Wrapping input files to process multiple
> sources
>
> 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/20060529/2835e860/attachment.html


More information about the antlr-interest mailing list