Re: re-enterant flex scanner

jhcheng@my-deja.com
1 Dec 1999 23:43:48 -0500

          From comp.compilers

Related articles
re-enterant flex scanner amnonc@mercury.co.il (Amnon Cohen) (1999-11-16)
Re: re-enterant flex scanner jhcheng@my-deja.com (1999-12-01)
| List of all articles for this month |
From: jhcheng@my-deja.com
Newsgroups: comp.compilers
Date: 1 Dec 1999 23:43:48 -0500
Organization: Deja.com - Before you buy.
References: 99-11-079
Keywords: lex

    "Amnon Cohen" <amnonc@mercury.co.il> wrote:
> What is the easiest way to write a re-entrant scanner using flex?
> The C++ mode provides reentrancy, but not parsing from a string
> (yy_scan_buffer) which I need.


There are two ways you may achieve this:


(a) sub-classing yyFlexLexer and overriding the method LexerInput() so
that the first parameter of LexerInput() holds the string you want to
parse;


(b) creating an istrstream from the string you want to parse
(myInStream) and using the constructor yyFlexLexer(myInStream) to
obtain your tokenizer.


Post a followup to this message

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