[omniORB] omniidl assert error about comments after upgrade from 2.8 to 3
Duncan Grisby
dgrisby@uk.research.att.com
Fri, 17 Mar 2000 17:43:12 +0000
On Friday 17 March, Stefan Seefeld wrote:
> One possibility to do this would be to make comments 'first class citizens'
> in your AST. Then your visitor base class would need another method (which
> probably is a noop in most cases) for visiting the comment.
Unfortunately, I don't think that's very feasible, since comments are
fundamentally different from other declarations. In particular, they
can appear anywhere in the input, including in the middle of a
declaration. Consider
interface I {
/* About to declare foo */
void /* No return type */ foo(long /* a long */ l);
/* foo has been declared */
};
If comments appear as nodes in the AST, where should the ones above
go? The AST will have to be identical to the AST of either
interface I {
/* About to declare foo */
/* No return type */
void foo(/* a long */ long l);
/* foo has been declared */
};
or
interface I {
/* About to declare foo */
void foo(long l /* a long */);
/* No return type */
/* foo has been declared */
};
So the front-end has to have some idea of how comments are ordered
relative to declarations. In my opinion, once it has that much
knowledge, it might as well attach the comments directly to the
declarations in question.
Also, even if there is a policy for placing comments in the AST, lots
of back-end code will have to be changed, since it doesn't all use the
visitor pattern. Operation nodes are assumed to only contain Parameter
nodes, for example. I don't think that back-ends should have to care
at all that there might be comments embedded in the AST.
Cheers,
Duncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --