|
Boost : |
From: Nico Massi (desertswat_at_[hidden])
Date: 2004-07-19 12:51:57
Hi,
I have a problem with a spirit parser.
My grammar/skipgrammer and its definition are working,
but only on the first spirit::parse() call.
My function around parse() looks like this.
void function()
{
string str;
file.open();
file >> str;
file.close();
vector<string> library;
vector<Group> groups;
MyGrammar g( library, groups );
MySkipGrammar s();
boost::spirit::parse( str, g, s );
// library and groups are now filled properly
setLibrary( library );
setGroups( groups );
}
This works fine, as long as i call function() only one time.
The second time i call the function ( even if the parse data(str) is the
same ),
the parse() function failes with a memory error ( access to 0xcccccccc
( MSVCs default debug value ) )
I have tried to debug it and found the following.
It seems that in the second call, the inner class(definition) of MyGrammer
is still referencing the old data.
And the first access in one rule actor to library or groups failes with
memory access to 0xcccccccc.
And even if a create MyGrammar on the heap ( MyGrammar* g = new... ) it
seems that the inner definition class
is not created the second time.
I have set breakpoints to a self created actor, and the actor is only
created once on the first function call.
Every other function() call other than the first does not create the
actors, so they are still hold the old object references.
Any ideas where the error could be? And why are the actors only created
once?
P.S.: I`m using MSVC.net 2003
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk