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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5c3042563529d4f3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.196.130 with SMTP id im2mr2010030pbc.3.1326492044928; Fri, 13 Jan 2012 14:00:44 -0800 (PST) Path: lh20ni178838pbb.0!nntp.google.com!news1.google.com!news2.google.com!news.glorb.com!news.netfront.net!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Data_Error and Enumeration_IO Date: Fri, 13 Jan 2012 15:00:42 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: <3f3d626a-1b8c-49af-aa85-9e586029a817@z12g2000yqm.googlegroups.com> NNTP-Posting-Host: 97.212.8.63 Mime-Version: 1.0 X-Trace: adenine.netfront.net 1326492044 58334 97.212.8.63 (13 Jan 2012 22:00:44 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Fri, 13 Jan 2012 22:00:44 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-01-13T15:00:42-07:00 List-Id: On 01/13/2012 02:30 PM, John McCormick wrote: > > Never be surprised about another's ignorance. I wasn't in the Ada > world during the discussions in the 1980s. The only thing in Jeff's > and Georg's notes of which I had not known was the reference to the > material on Data_Error and real types. From that it seems that the > parsing of a potential floating point number uses knowledge of > previously entered characters. For example, if you enter "1.2E." it > recognizes that the second decimal point is an error. Yet when you > enter "abc" in my original example for enumeration IO, it cannot > recognize that no valid enumeration literal starts with an a. It has > to process the entire identifier before it can see that. So the crux > of my question is why doesn't the consumption of characters for > enumeration input behave like that of real input. It doesn't really > matter other than to satisfy my curiosity. The consumption of characters is the same in both case: they consume characters as long as the characters follow the syntax of a literal for the type class (the class of floating-point types in one case, of enumeration types in the other). For floating-point types, that's anything that's a valid real literal, even if it's outside the range of the type. For an enumeration it's anything that's a valid identifier or character literal. Equivalent examples to "1.2E." for an enumeration type are "'ab" or "a_*". Note that enumeration input will consume all of "'a'" even if the enumeration type has no character literals. -- Jeff Carter "Sir Robin the not-quite-so-brave-as-Sir-Lancelot, who had nearly fought the Dragon of Angnor, who nearly stood up to the vicious Chicken of Bristol, and who had personally wet himself at the Battle of Badon Hill." Monty Python & the Holy Grail 68 --- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---