From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c689b55786a9f2bd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: for S'Image use Func?? Date: Thu, 13 May 2010 21:20:54 +0300 Organization: Tidorum Ltd Message-ID: <852u87Fr5cU1@mid.individual.net> References: <4be417b4$0$6992$9b4e6d93@newsspool4.arcor-online.net> <1qcb6z4i20dyb.1dz2hd4c0vx69.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net RTaMowXK8GJAXwULHHI09Q/MMg0lFdpHBdm2xTMbIwazG4+OE+ Cancel-Lock: sha1:gL8WcXyICGQSOLapExtbEK3yytc= User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:11588 Date: 2010-05-13T21:20:54+03:00 List-Id: J-P. Rosen wrote: > Warren a �crit : >> J-P. Rosen expounded in news:hsb97m$tnd$1@news.eternal-september.org: >> >>> Dmitry A. Kazakov a �crit : >>>> On Mon, 10 May 2010 18:50:02 +0000 (UTC), Warren wrote: >>>> >>>>> But you have no way to know when you've read >>>>> a empty line in a lexer routine that is reading >>>>> character by character. >>> Come on, here is the magic function: >>> >>> function Empty_Line return Boolean is >>> begin >>> return Col=1 and End_Of_Line; >>> end Empty_Line; >> There's a wart-- see earlier posts about "end file". >> > Of course, this assumes an well-formed Ada file. > FYI, there /is/ a scanner in AdaControl, and I never had a problem. > The trick is to check End_Of_Line when needed, and never check > End_Of_File, but handle End_Error instead. This works even for > ill-formed files. I don't think that this trick will help with the "wart", which is the invisibility of a final null (zero-length) line in a Text_IO file. As best I understand it, the Text_IO view of a text file as a sequence of lines excludes the case of a file with no lines at all, which logically would consist of a file terminator, possibly preceded by a page terminator, but not preceded by a line terminator. Text_IO insists that the file terminator is always preceded by line and page terminators, logically if not physically, and the Text_IO operations are defined to hide the physical presence or absence of a final line terminator at the end of the file. Therefore every Text_IO file seems to have at least one line terminator, and thus at least one line. > And of course, you are welcome to have a look at my scanner in > AdaControl ;-) I did, and I even compiled and tried it, but since your scanner ignores and skips all line terminators (there is no "end of line" token kind), its operation does not illuminate the question of the "wart". But this "wart" is a very small blemish, perhaps just a beauty mark, as it has no effect on most uses of Text_IO, for scanners or otherwise. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .