On Friday 16 September 2005 20:28, Evan Lavelle wrote: > struct yystype { > ... > antlr::RefToken tok; > antlr::RefAST ast; > }; > > #define YYSTYPE yystype
Yupp, that is an attractive solution from a memory management perspective. However, I have trouble with connecting flex to that. This is my type: struct mType { DOMString string; SharedQName::Ptr qname; Cardinality::Ptr cardinality; Expression::List *expressionList; Expression::Ptr expression; ItemType::Ptr itemType; SequenceType::Ptr sequenceType; }; and I have the following in the C-section of the Bison file: #define YYSTYPE mType The parser compiles fine, but my flex grammar bails with: ------------ XPathLexer.l:98: error: request for member `string' in `XPathlval', which is of non-class type `YYSTYPE' (etc) ---------- Line 98 looks like this: XPathlval.string = DOMString(&(XPathtext[0])); The mType struct is included into the XPathLexer so the compiler sees it. It feels as if I've gotten something dead wrong, but in a nutshell: how do I integrate with flex when using a YYSTYPE that is a struct? (From the top of my head it would be nice if one could combine different types for different types of "entities". Say, a union for tokens, and an YYSTYPE struct for non-terminals. And yes, I also think the mType struct is inefficient performance wise.) Cheers, Frans _______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison