Path: csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Jens Kallup Newsgroups: comp.compilers Subject: lex - how to get current file position of parser file Date: Tue, 1 Sep 2015 04:20:53 +0200 Organization: Aioe.org NNTP Server Lines: 29 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <15-08-019@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: miucha.iecc.com 1441076872 85621 2001:470:1f07:1126:0:676f:7373:6970 (1 Sep 2015 03:07:52 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Tue, 1 Sep 2015 03:07:52 +0000 (UTC) Keywords: lex, question Posted-Date: 31 Aug 2015 23:07:52 EDT 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:1595 Hello, I used flex, and bison under Linux. But how can I handle multiple input files? When I follow the examples of the documentation, I fail to handle tokens after include file. Example: PRINT "Before" SET PROCEDURE TO testproc PRINT "After" this is a abstract language, which does (should) open a file called "testproc". But I can not handle line 3. I try to "ftell" the position after testproc, but get the size of the parser file. So, now I have no glue, how to fix that. It would be great, if someone have a idea, and maybe a short code snippet. Thanks Jens [Flex buffers its input, so you can't just do an ftell(). Use the yy_create_buffer() and related routines. If you have a copy of my book "flex & bison" there's an example of nested include files in chapter 2. -John]