[antlr-interest] Can't find template actionSetAttribute.st; group hierarchy is [Java]

Sergei Smolov ssedai at gmail.com
Tue Jun 1 02:45:49 PDT 2010


Jim, Terence,

Thanks for your replies.

Well, my grammar is too huge to be posted here (about 2000 lines), so I 'll
tell about its main idea.
I want to use ANTLR to generate SIP protocol parser. But the main feature of
my grammar is its output. I don't want to use AST, I want to have just Java
classes hierarchy, but not tree.

Here is a fragment of my grammar code:


request_line *returns* [RequestLine line = *new* RequestLine()]

: method ' ' request_uri ' ' sip_version crlf

{

$line.method = $method.text;

$line.uri = $request_uri.uri;

$line.version = $sip_version.version;

};
I want that after parsing "request_line", that contains, for simplification,
three strings ("method", "request_uri" and "sip_version"), separated by
space, and carriage return-line feed, the RequestLine object to be
generated. I wrote the following Java class, that describes such object:

*

public* *class* RequestLine *extends* ModelObject {

*public* String method;

*public* ModelObject uri;

*public* SIPVersion version;

}
All my grammar has the same structure: every rule has "returns" block, where
appropriate class is described. In most cases, "returns" block contains only
"[String text]" value, by the way.

Terence, would you be so kind to explain what do you mean? Should I wrote my
Java.stg by myself, or not?
Thanks in advance.
2010/5/31 Jim Idle <jimi at temporal-wave.com>

> You have not posted enough information for anyone to help. But you must be
> referencing something that isn't implemented. Post your grammar? Or grep the
> ANTLR source?
>
> Jim
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Sergei Smolov
> > Sent: Monday, May 31, 2010 4:07 AM
> > To: antlr-interest
> > Subject: [antlr-interest] Can't find template actionSetAttribute.st;
> > group hierarchy is [Java]
> >
> > Hello, List!
> >
> > I'm writing a SIP protocol parser and now I am using Antlr 3.2. While
> > code
> > generation I've encountered the following error:
> >
> > java.lang.IllegalArgumentException: Can't find template
> > actionSetAttribute.st; group hierarchy is [Java]
> > The thing is that I do not use a standard value of "output" option (I
> > need
> > to generate my own class hierarchy, not AST\CommonTree).
> > So what can be the solution of my problem?
> > Thanks in advance.
> >
> > --
> > Sergey Smolov
> >
>  > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> > email-address
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



-- 
Sergey Smolov


More information about the antlr-interest mailing list