[antlr-interest] Grammar File: Get text from token
luciano mantuaneli
mantu_lists at yahoo.com.br
Wed Nov 1 11:53:34 PST 2006
Greetings!
I'm working with a java grammar and in some point, I want to retrieve the class name. The rule is like follows:
// Definition of a Java class
classDefinition![AST modifiers]{
boolean isInner = ts.getName() != null;
}
: "class" IDENT{
String txt = $getText;
ts.setName(txt);
}
// it _might_ have type paramaters
(tp:typeParameters)?
// it _might_ have a superclass...
sc:superClassClause
// it might implement some interfaces...
ic:implementsClause
// now parse the body of the class
cb:classBlock
{#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"],
modifiers,IDENT,tp,sc,ic,cb);}
;
It doesn't work that way. The ANTLR Plugin says that "_begin cannot be resolved".
How can I retrieve the name of the class being parsed?
Thank you all!
Luciano Mantuaneli
Analist-Programmer
---------------------------------
Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061101/63d1c714/attachment.html
More information about the antlr-interest
mailing list