hello to everybody,
i'm new to flex bison and i'm experiencing a strange problem. I have
wirtten a C++ parser using
flex 2.5.33-r1 and bison 2.2. I have to parse two different files, with
the same structure, so i decide to use the same parser twice.
The problem is that when i parse one file OR the other everything is ok,
but when i parse both (no matter the order) or when i
parse one of the two twice, i get a segmentation fault. Using gdm i
isolated the following code:
void assoc_parser(brianBehaviors *bb) {
assocparser_linenumber = 2;
// sl = new assoc_list();
// s = new assoc();
assoc_init();
//assocdebug=1;
assoc_bbehavior = bb;
assoc_v = new variable();
printf("ready to parse...\n");
assocparse();
printf("...parsing done\n");
delete assoc_v;
assoc_cancel_memory_leaks();
}
I just solved the problem. The function assoc_cancel_memory_leaks()
created the problem. I moved its invocation into the destructor of the
parser,
to invoke it ony once at the end. Here is its implementation:
void assoc_cancel_memory_leaks()
{
/* For non-reentrant C scanner only. */
assoc_delete_buffer(YY_CURRENT_BUFFER);
yy_init = 1;
}
Thanks a lot,
Luigi
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Refill s.r.l. - Tutto per la tua stampante a prezzi incredibili: su cartucce,
toner, inchiostri, carta speciale risparmi fino al 90%!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5189&d=7-1
_______________________________________________
help-flex mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-flex