diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2007-04-01 01:27:57 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2007-04-01 01:27:57 +0000 |
commit | e3abe207f764929a97eafa503a3780d5b7636ed2 (patch) | |
tree | 84f144eb96d5794911b2fc5ef5487e419f76caf9 /toke.c | |
parent | 90e3715fae5c61e6e1833dc9ad520176419400f4 (diff) | |
download | perl-e3abe207f764929a97eafa503a3780d5b7636ed2.tar.gz |
Make parser_free() be called slightly later,
i.e. at the point where lexer vars are being restored in a LEAVE,
rather than at the end of yyparse()
p4raw-id: //depot/perl@30822
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -615,8 +615,7 @@ S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen) /* * Perl_lex_start - * Initialize variables. Uses the Perl save_stack to save its state (for - * recursive calls to the parser). + * Create a parser object and initialise its parser and lexer fields */ void @@ -641,6 +640,9 @@ Perl_lex_start(pTHX_ SV *line) parser->yyerrstatus = 0; parser->yychar = YYEMPTY; /* Cause a token to be read. */ + /* on scope exit, free this parser and restore any outer one */ + SAVEPARSER(parser); + /* initialise lexer state */ SAVEI32(PL_lex_state); @@ -713,6 +715,20 @@ Perl_lex_start(pTHX_ SV *line) PL_rsfp = 0; } + +/* delete a parser object */ + +void +Perl_parser_free(pTHX_ const yy_parser *parser) +{ + Safefree(parser->stack); + Safefree(parser->lex_brackstack); + Safefree(parser->lex_casestack); + PL_parser = parser->old_parser; + Safefree(parser); +} + + /* * Perl_lex_end * Finalizer for lexing operations. Must be called when the parser is |