jison
jison copied to clipboard
[feature req] add `%destructor` support
Cf. https://www.gnu.org/software/bison/manual/html_node/Destructor-Decl.html (bison manual page about %destructor)
See also http://stackoverflow.com/questions/6401286/when-is-destructor-invoked-in-bison
%destructor is also very useful in JavaScript to prevent memory leaks when your lexer produces yylval token values (in jison, that would be in lexer.yytext ATM...) which are object instances which don't garbage collect easily (e.g. when they're part of an object reference cycle, which must be 'broken up' before the garbage collector will be able to do its job).