Loading ...
Sorry, an error occurred while loading the content.
 

RE: [antlr-interest] Walking an AST with a TreeParser

Expand Messages
  • mzukowski@yci.com
    A grammar is the wrong way to do what you want. You would need a syntactic predicate in the rule below, and also have to handle the case where the node has
    Message 1 of 2 , Jul 31, 2002
      A grammar is the wrong way to do what you want. You would need a syntactic
      predicate in the rule below, and also have to handle the case where the node
      has both a child and a sibling.

      Instead try using the findAll() or findAllPartial() methods defined in
      AST.java and implemented in BaseAST.java.

      Monty

      > -----Original Message-----
      > From: Remi [mailto:remi.koutcherawy@...]
      > Sent: Wednesday, July 31, 2002 6:18 AM
      > To: antlr-interest@yahoogroups.com
      > Subject: [antlr-interest] Walking an AST with a TreeParser
      >
      >
      > I am looking for a way to traverse completely an AST with a
      > TreeParser.
      > How can you visit all the leafs with a simple rule ?
      >
      > sibling : #( . sibling) | . sibling ;
      >
      > doesn't work, it ends with a "<AST>: unexpected end of subtree"
      >
      > My intent is to look only for special nodes without
      > either handcode in java or import a whole grammar.
      >
      > RĂ©mi
      >
      >
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.