Make the lexer reentrant (to avoid "still reachable" memory).

This allows the final program to be 100% "valgrind clean", (freeing
all memory that it allocates). This will make it much easier to ensure
that any allocation that parser actions perform are also cleaned up.
This commit is contained in:
Carl Worth
2010-05-10 11:52:29 -07:00
parent 3a37b8701c
commit 38aa83560b
3 changed files with 14 additions and 4 deletions

View File

@@ -24,5 +24,12 @@
int
main (void)
{
return yyparse ();
int ret;
void *scanner;
yylex_init (&scanner);
ret = yyparse (scanner);
yylex_destroy (scanner);
return ret;
}