Related articles |
---|
[5 earlier articles] |
Re: Buffered input for a lexer? rhyde@cs.ucr.edu (Randall Hyde) (2002-03-25) |
Re: Buffered input for a lexer? cfc@world.std.com (Chris F Clark) (2002-03-25) |
Re: Buffered input for a lexer? clint@0lsen.net (2002-03-31) |
Re: Buffered input for a lexer? sabre@nondot.org (Chris Lattner) (2002-03-31) |
Re: Buffered input for a lexer? sabre@nondot.org (Chris Lattner) (2002-03-31) |
Re: Buffered input for a lexer? joachim_d@gmx.de (Joachim Durchholz) (2002-03-31) |
Re: Buffered input for a lexer? cgweav@aol.com (2002-03-31) |
Re: Buffered input for a lexer? bear@sonic.net (Ray Dillinger) (2002-04-10) |
Re: Buffered input for a lexer? bear@sonic.net (Ray Dillinger) (2002-04-10) |
Re: Buffered input for a lexer? cgweav@aol.com (2002-04-13) |
Re: Buffered input for a lexer? ralph@inputplus.co.uk (2002-04-16) |
Re: Buffered input for a lexer? joachim_d@gmx.de (Joachim Durchholz) (2002-04-16) |
Re: Buffered input for a lexer? cgweav@aol.com (2002-04-17) |
[6 later articles] |
From: | cgweav@aol.com (Clayton Weaver) |
Newsgroups: | comp.compilers |
Date: | 31 Mar 2002 23:26:34 -0500 |
Organization: | AOL http://www.aol.com |
References: | 02-03-171 |
Keywords: | lex, practice |
Posted-Date: | 31 Mar 2002 23:26:34 EST |
Files not terminated with newlines are rare, right? Just put one
there.
Ie, if the source file and directory are writable for your process,
truncate the file out 1 byte and add a newline. If the source files
are read-only, copy it to a temp directory and add the newline, then
operate on the copy of the source file.
Since you will not commonly need to do this, the extra i/o latency
should not have much impact on average compile time, and you eliminate
that special case from the actual token boundary detection.
Regards,
Clayton Weaver
<mailto: cgweav@aol.com>
Return to the
comp.compilers page.
Search the
comp.compilers archives again.