Path: csiph.com!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!news.linkpendium.com!news.linkpendium.com!news.iecc.com!nerds-end From: Jens Kallup Newsgroups: comp.compilers Subject: restart bison parser Date: Fri, 02 Mar 2012 21:17:32 +0100 Organization: Compilers Central Lines: 28 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-03-003@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1330723001 32217 64.57.183.58 (2 Mar 2012 21:16:41 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Fri, 2 Mar 2012 21:16:41 +0000 (UTC) Keywords: yacc, question, comment Posted-Date: 02 Mar 2012 16:16:41 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:470 Hello, I have develop a small software program, that use a bison/yacc/flex grammar to do some task's. When I start the program from the console, and no error's are available in the script, the execution is fine. But when the parser finds an error, the program stops (gui) and returns to the next point of program (e.g. display a message). Then, if the parser is restart (in the running gui), I get error's that can't be recover. I search google, but found not realy helpfull information's. So, I try some woodoo coding in the flex .l file. Each rule becomes a '"token" {BEGIN(INITIAL); return _TOKEN_;}' It seems not working fine. Thats the problem: "How to scan a script in a gui program more than one times?". "So, the scanner/parser is part of the one program." I'm happy For any help. Thank's Jens [The usual problem is that there is still buffered text in the scanner. A call to yyrestart(), perhaps with a subsequent call to point the input where you want it, and BEGIN INITIAL usually do the trick. -John]