[antlr-interest] change a portion of a tree (trying)

Lloyd Dupont lloyd at nova-mind.com
Sun May 29 21:38:21 PDT 2005


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"], ##); }
   ;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050530/cc6d5b32/attachment-0001.html


More information about the antlr-interest mailing list