[antlr-interest] Bug ? In C++, the parameters passed to a rule become ASTRefCount<AST>
Anthony Brenelière
abreneliere at telys.com
Thu Jul 17 02:37:25 PDT 2003
// Here is the root rule, ciaoTreeDocument :
ciaoTreeDocument
: ( statementA )*
;
// A pointer is created, named '_curstat'.
// This pointer is passed to the rule 'statProperties'
// Everything is OK when the rule is called, and _curstat is OK, with a
type 'CObject *'
statementA
{
CObject * _curstat = world->addObject();
_curstat->aP(CATEGORY, "Statement");
}
: #(R_STA ( statProperties[ _curstat ])* statement)
;
// In the statProperties rule, _curstat has changed : the value of the
pointer has changed, // and the type of _curstat has also changed :
// _curstat IS NOW 'antlr::ASTRefCount<antlr::AST>' instead of 'CObject
*' !!!!!!!!!!!
statProperties
[ CObject * _curstat ]
: statStateA[ _curstat ]
| statId[ _curstat ]
;
So, my question is :
Any idea to pass a pointer from a rule to another rule in the Treewalker
in
C++ ?
Cordially,
Anthony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030717/72f8e5fd/attachment.html
More information about the antlr-interest
mailing list