[antlr-interest] change a portion of a tree (trying)
Lloyd Dupont
lloyd at nova-mind.com
Sun May 29 22:37:21 PDT 2005
thanks for that ;)
----- Original Message -----
From: Davin McCall
To: Lloyd Dupont
Cc: antlr-interest at antlr.org
Sent: Monday, May 30, 2005 3:22 PM
Subject: Re: [antlr-interest] change a portion of a tree (trying)
Looks like you need to change the bluish part to:
// or just a category
cat:( LPAREN! tCat:ID RPAREN! )
{
## = #( #[ObjcCATEGORY, "categorie"], #tCat );
}
What you had:
#cat = #( #[ObjcCATEGORY, "categorie"], #tCat );
##.addChild(#cat);
... first sets #cat to
ObjCATEGORY
+ ID
... but ## is still ID, so "##.addChild(#cat)" then gives you:
ID
+ ObjCATEGORY
+ ID
Hope this helps,
Davin
Lloyd Dupont wrote:
objcClassDefinition
: AT_INTERFACE! tName:ID
(
// 1st declaration
(COLON! ID)? /* super class */
(objcProtocolList)? /* protocols */
// instance variable
(
LCURLY
( declaration ) *
RCURLY
)?
|!
// or just a category
cat:( LPAREN! tCat:ID RPAREN! )
{
#cat = #( #[ObjcCATEGORY, "categorie"], #tCat );
##.addChild(#cat);
}
)
( objcMethodName SEMI! ) *
AT_END!
{ ## = #( #[ObjcCLASS_DEF, "@interface"], ##); }
;
but doesn't work exactly as intended...
I have a tree like
ObjcCLASS_DECLARATION
+ ID /* tName */
+ ID /* my cat name */
+ ObjcCategory
+ ID /* my cat name */
instead of
ObjcCLASS_DECLARATION
+ ID /* tName */
+ ObjcCategory
+ ID /* my cat name */
?? quite puzzling ...
----- Original Message -----
From: Lloyd Dupont
To: antlr-interest at antlr.org
Sent: Monday, May 30, 2005 2:08 PM
Subject: [antlr-interest] change a portion of a tree
here (in red) I tried to edit a portion of my tree, but that didn't work.. any idea?
objcClassDefinition
: AT_INTERFACE! tName:ID
(
// 1st declaration
(COLON! ID)? /* super class */
(objcProtocolList)? /* protocols */
// instance variable
(
LCURLY
( declaration ) *
RCURLY
)?
|
// or just a category
LPAREN! tCat:ID RPAREN!
{ #tCat = #( #[ObjcCATEGORY, "categorie"], #tCat); }
)
( objcMethodName SEMI! ) *
AT_END!
{ ## = #( #[ObjcCLASS_DEF, "@interface"], ##); }
;
protected objcProtocolList
: LT! ID (COMMA! ID) * GT!
{ ## = #( #[ObjcPROTOCOL, "@protocol"], ##); }
;
--
Davin McCall, Research Programmer
Deakin University, Burwood, Australia.
Phone: 03 9251 7045 International: +61 3 9251 7045
Email: Davin.McCall at deakin.edu.au
Website: http://www.deakin.edu.au
Deakin University CRICOS Provider Code 00113B (Vic)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050530/e0e98f95/attachment.html
More information about the antlr-interest
mailing list