Hi, I have a a question about how to reuse a scanner, The document (which is flex.pdf -- Flex, version 2.5.31) says
there is no need to destroy a scanner if you plan to reuse it. A flex scanner (both reentrant and non-reentrant) may be restarted by calling yyrestart my question is : 1. Is it safe, for a long lived applicaion to reuse a scanner all the time by calling yyrestart(..) ? will there be any dangling resources, which are not released or freed by doing so??? 2. Does yy_scan_buffer (or yy_scan_string) internally do the "yyrestart things" ? what I mean is my scanner scans "strings", instead of "stdin". so, if i want to reuse a scanner, do I have to call yyrestart(NULL , my_scanner), and then call yy_scan_buffer(.....) ??? or I can just call yy_scan_buffer(.....), and it internally does the "yyrestart things" ? THANX Sting The function yylex_destroy should be called to free resources used by the scanner. After yylex_destroy is called, the contents of yyscanner should not be used. Of course, there is no need to destroy a scanner if you plan to reuse it. A flex scanner (both reentrant and non-reentrant) may be restarted by calling yyrestart -- Sting, Cheng Po-wen(鄭博文) Phone : 886-3-5914545 Fax : 886-3-5820085 E-Mail : [EMAIL PROTECTED] Internet Software Technology Division(W100) Computer & Communication Research Lab. / ITRI _______________________________________________ Help-flex mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-flex
