[antlr-interest] Another question (array of char instead of filename for lexer)

Ric Klaren klaren at cs.utwente.nl
Tue Nov 27 13:47:17 PST 2001


On Tue, Nov 27, 2001 at 06:27:13PM -0000, timo.haberkern at fantastic-bits.de wrote:
> i have another question. My parser with antlr works fine. Now i want
> to start the lexing not with a filename. I want to use a char array.
> In all examples i found there is the only way over the filename. 
> Is there an easy solution, so that i can set a large char array as the
> "file" to parse.

Use a istrstream as input stream or use a modified inputbuffer. There's
one of Ruslan Zashukin floating in the archive and also one of Geoff Leland
(if I got the name right). I'm not quite sure if I added it to my devel
version yet have to check... My devel version also contains an example of
the strstream approach, it should also be on the forum (and maybe even the
faq..) Mail me directly if you need one of these.

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     Human beings, who are almost unique in having the ability to learn
   from the experience of others, are also remarkable for their apparent
         disinclination to do so. --- Douglas Adams, Last Chance to See


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list