Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1595

lex - how to get current file position of parser file

From Jens Kallup <jkallup@web.de>
Newsgroups comp.compilers
Subject lex - how to get current file position of parser file
Date 2015-09-01 04:20 +0200
Organization Aioe.org NNTP Server
Message-ID <15-08-019@comp.compilers> (permalink)

Show all headers | View raw


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]

Back to comp.compilers | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

lex - how to get current file position of parser file Jens Kallup <jkallup@web.de> - 2015-09-01 04:20 +0200
  Re: lex - how to get current file position of parser file Kaz Kylheku <kaz@kylheku.com> - 2015-09-01 14:19 +0000
    Re: lex - how to get current file position of parser file federation2005@netzero.com - 2015-09-03 15:47 -0700
      Re: include files, was lex - how to get current file position of parser file Kaz Kylheku <kaz@kylheku.com> - 2015-09-04 05:26 +0000
    Re: lex - how to get current file position of parser file Gene Wirchenko <genew@telus.net> - 2015-09-03 18:19 -0700
      Re: lex - how to get current file position of parser file Jens Kallup <jkallup@web.de> - 2015-09-06 21:53 +0200
        Re: lex - how to get current file position of parser file Kaz Kylheku <kaz@kylheku.com> - 2015-09-07 05:59 +0000
    Re: lex - how to get current file position of parser file Jens Kallup <jkallup@web.de> - 2015-09-07 17:11 +0200

csiph-web