[antlr-interest] V3.0b Internal Error...

Robert Hill rob.hill at blueyonder.co.uk
Mon Oct 9 15:06:32 PDT 2006


Thanks for the link David.. I'd already done a work around which was just as
you'd said :)

sqlTransfer[Service s]
	: Select sqlParams[s] 		-> ^(SQLSELECT sqlParams)
	| Update sqlParams[s] 		-> ^(SQLUPDATE sqlParams)
	| Insert sqlParams[s] 		-> ^(SQLINSERT sqlParams)
	| Delete sqlParams[s] 		-> ^(SQLDELETE sqlParams)
	;
sqlParams[Service s]
	:	Identifier Using! Identifier Semi! 	
	{.....}
	;

Which is working fine, I didn't know whether anyone had come across this
before. Also I seem to remember Ter trying to produce an internal error,
though I don't think it was this one! 

Cheers!

Rob




> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of David Holroyd
> Sent: 09 October 2006 22:56
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] V3.0b Internal Error...
> 
> Oops,
> 
> On Mon, Oct 09, 2006 at 09:53:48PM +0000, David Holroyd wrote:
> > On Mon, Oct 09, 2006 at 09:41:44PM +0100, Robert Hill wrote:
> > > I have a rule in my grammar:
> > >
> > > sqlTransfer[Service s]
> > > 	:   ( Select |  Update | Insert | Delete )
> > > 		param=Identifier Using mapping=Identifier Semi
> > > 	{
> > > 			//some Java Code...
> > > 	}
> > > 	-> ^(SQLCODE )
> > >
> > > Which generates the following
> > >
> > > ANTLR Parser Generator   Early Access Version 3.0b4 (??, 2006)  1989-
> 2006
> > > internal error: D:\ActiveProjects\IdeaProjects\Jtest1\src\SGenParser.g
> :
> > > java.lang.IllegalArgumentException: Can't find template
> matchSetTrack.st
> > >
> org.antlr.stringtemplate.StringTemplateGroup.lookupTemplate(StringTemplate
> Gr
> > > oup.java:485)
> > > ......
> > >
> > > however if I remove the brackets round the first set (select..Delete)
> the
> > > error goes away.
> > > I'm just trying to get it to emit a branch for this rule, it doesn't
> matter
> > > what I put in the re-write, I still get the error if the brackets are
> there.
> > > Also, if I remove the rewrite , the error goes away.
> >
> > Ter has said something about this in the past...
> >
> >   http://www.antlr.org/pipermail/antlr-interest/2006-
> August/017341.html
> >
> > ...seems it's something unfinished in current the v3 releases.
> >
> > You may be able to work around it by putting Select|Update|Insert|Delete
> > into a subrule (I've not tried it, so sorry if it doesn't actually
> work).
> 
> I should have said 'another rule', not 'a subrule'.
> 
> 
> ta,
> dave
> 
> --
> http://david.holroyd.me.uk/




More information about the antlr-interest mailing list