[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Confusion



Hi,

Perhaps someone can clear this up for me - I hope it doesn't expose a
yawning misunderstanding of the Framework :).

I have a modified Java 1.1 parser that I'm using to preprocess an extended
Java language.  In my extended AnalysisAdapter that is walking the tree I
want to output some code when I hit a new keyword that implements a block in
the form

  keyword {
    ... lines of code
  }

In this case I have

  public void caseAKeywordStatement(AKeywordStatement node) {
    inAKeywordStatement(node);
    ...
    if (node.getBlock() != null) {
      PBlock block = node.getBlock();
      Object[] temp = block.getBlockStatement().toArray();
      for (...) {
        ... deal with each statement
      }
    }
    outAParStatement(node);
  }

My problem is the line

  PBlock block = node.getBlock();

I seem to need an ABlock to be able to access the elements (with
getBlockStatement)- I don't really understand the difference.  Here a block
is defined in the same way it is in the Java 1.1 grammar.  I could see it
would make sense if a PBlock has an ABlock as its child perhaps, but how to
I access it?  what is the point in getBLock returning a class of abstract
type (I tried casting it to an ABlock, just in case I'd missed something).

Help!!

Cheers,

Jim Moores
--
Director, Quickstone Technologies Limited, UK