G
Gus Gassmann
Not sure if this is a C++ question. If not, I apologize. Is there a
group where I could direct questions that deal with flex?
My situation is this: I have a (fairly complicated) C++ object (call it
Obj, perhaps) that I need to populate by parsing a string. I use
flex/bison to parse the string, and I currently have another C++ class,
ObjReader, containing a method readObj(std::string objStr) that calls
the parser and stores the information read into the various elements of
a private member Obj* ObjReader->my_obj.
My problem is that I constantly get into memory trouble (variously leaks
and segfaults), because I ultimately want to access the data from my own
instance of Obj and often trigger (viz., construct/destruct) the reader
in a subroutine. I feel --- given what little I know of C++ and OOP ---
that I would be better off if I could make the ObjReader a member of the
Obj class.
However, I am quite unsure of how to handle the flex construct yyextra
in this context. I have tried to find examples on the web for anything
similar to what I want to do, and I have so far turned up nothing.
Any ideas?
Thanks in advance
gus
group where I could direct questions that deal with flex?
My situation is this: I have a (fairly complicated) C++ object (call it
Obj, perhaps) that I need to populate by parsing a string. I use
flex/bison to parse the string, and I currently have another C++ class,
ObjReader, containing a method readObj(std::string objStr) that calls
the parser and stores the information read into the various elements of
a private member Obj* ObjReader->my_obj.
My problem is that I constantly get into memory trouble (variously leaks
and segfaults), because I ultimately want to access the data from my own
instance of Obj and often trigger (viz., construct/destruct) the reader
in a subroutine. I feel --- given what little I know of C++ and OOP ---
that I would be better off if I could make the ObjReader a member of the
Obj class.
However, I am quite unsure of how to handle the flex construct yyextra
in this context. I have tried to find examples on the web for anything
similar to what I want to do, and I have so far turned up nothing.
Any ideas?
Thanks in advance
gus