[antlr-interest] Grouping the parsed data

Marcel Cerveny mcerveny at gmail.com
Mon Mar 7 01:58:56 PST 2005


Hello there!

After a while of really pleasant work with antlr I bumped into one problem.
I do a parsing of quite general source files, which describe
interfaces. However one of the requirements is to have a freedom of
placing say other used interfaces, meaning one interface source could
look like:
public interface ITest {
  using John, Paul;
  const int aaa = 1;
  int bbb;
  using George, Ringo;
  int ccc();
}

My problem is that I want to have the using node stored as the
firstChild of the curly bracket. Moreover, I want all the uses
specified later have stored as the children of (first) uses node.

Now, I can create an mandatory (actual or { ## = #[EMPTY]; }) using
node, but how can I move parsed information into other node during the
process of parsing. Of course I can to rearrange the AST after being
created, but I'd like to make this during parsing, if it is possible.

Thanx in advance for any of your hints.
Marcel


More information about the antlr-interest mailing list