lex - how to get current file position of parser file

Jens Kallup <jkallup@web.de>
Tue, 1 Sep 2015 04:20:53 +0200

          From comp.compilers

Related articles
lex - how to get current file position of parser file jkallup@web.de (Jens Kallup) (2015-09-01)
Re: lex - how to get current file position of parser file kaz@kylheku.com (Kaz Kylheku) (2015-09-01)
Re: lex - how to get current file position of parser file federation2005@netzero.com (2015-09-03)
Re: lex - how to get current file position of parser file genew@telus.net (Gene Wirchenko) (2015-09-03)
Re: include files, was lex - how to get current file position of parse kaz@kylheku.com (Kaz Kylheku) (2015-09-04)
Re: lex - how to get current file position of parser file jkallup@web.de (Jens Kallup) (2015-09-06)
Re: lex - how to get current file position of parser file kaz@kylheku.com (Kaz Kylheku) (2015-09-07)
[1 later articles]
| List of all articles for this month |
From: Jens Kallup <jkallup@web.de>
Newsgroups: comp.compilers
Date: Tue, 1 Sep 2015 04:20:53 +0200
Organization: Aioe.org NNTP Server
Keywords: lex, question
Posted-Date: 31 Aug 2015 23:07:52 EDT

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]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.