[antlr-interest] Composite grammars and "no start rule" warning

Daniels, Troy (US SSA) troy.daniels at baesystems.com
Mon Jul 13 15:10:00 PDT 2009



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Peterson, Joe
> Sent: Monday, July 13, 2009 5:06 PM
> To: Gavin Lambert; antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Composite grammars and "no start rule"
> warning
> 
> > If you are using another_file from other contexts (or if the above
> > doesn't work), then you could try defining a throwaway rule in
> > another_file.g:
> 
> > another_start : list EOF;
> 
> Ah, yeah, I could do this one. I remember either reading about this or
> doing this before. Today, it didn't occur to me to write code that
will
> never be tested. My code coverage shouldn't suffer too much and I like
> this better than using a single rule to call into the file every time.
> 

It's probably better from a style point of view to call the rule
something like __prevent_compiler_warnings.  That makes it obvious that
you're not expecting to have the rule called.

Troy



More information about the antlr-interest mailing list