
"Nico Massi" <desertswat@gmx.de> wrote in message news:opsbebwvw8yic797@swat...
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.
Without seeing MyGrammar and MySkipGrammar your not likely to get much help. Post a stripped down to the minimally complete/compilable code sample. Also you might want to post on the spirit mailing lists. Jeff F