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,CP1252 Received: by 10.68.211.195 with SMTP id ne3mr129383pbc.2.1326409346063; Thu, 12 Jan 2012 15:02:26 -0800 (PST) Path: lh20ni175330pbb.0!nntp.google.com!news2.google.com!news1.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: Thu, 12 Jan 2012 16:02:23 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: <3f3d626a-1b8c-49af-aa85-9e586029a817@z12g2000yqm.googlegroups.com> NNTP-Posting-Host: 97.226.201.197 Mime-Version: 1.0 X-Trace: adenine.netfront.net 1326409345 90589 97.226.201.197 (12 Jan 2012 23:02:25 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Thu, 12 Jan 2012 23:02:25 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: <3f3d626a-1b8c-49af-aa85-9e586029a817@z12g2000yqm.googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Date: 2012-01-12T16:02:23-07:00 List-Id: On 01/12/2012 03:41 PM, John McCormick wrote: > > However, when my students leave out the call to Skip_Line in the > Data_Error exception handler the behavior depends on the actual value > entered. It still works as desired when the input is alphabetic > characters such as �abc�. But when the input consists of digits such > as �123� the loop becomes infinite, repeating the prompt and error > message. It appears to me that the call to Choice_IO.Get consumes the > alphabetic input but does not consume the digit input leaving it > available for the next call to Get. I could not find anything in the > language reference manual about how Enumeration_IO consumes input > characters when Data_Error is raised. Can anyone give me an > explanation? Is it implementation defined? I am running GNAT GPL > 2011. ARM A.10.10 says of Get, "After skipping any leading blanks, line terminators, or page terminators, reads an identifier according to the syntax of this lexical element (lower and upper case being considered equivalent), or a character literal according to the syntax of this lexical element (including the apostrophes)." Ignoring the part about character literals, it reads characters as long as they could be an identifier ("abc", for example; "a123" could also be an identifier). If the identifier so read is not a value of the type, you get Data_Error, but the characters have been skipped in the input. Input that begins with something that could not be the 1st character of an identifier is left to be read again, so "123" gives you the infinite loop. -- Jeff Carter "My legs are gray, my ears are gnarled, my eyes are old and bent." Monty Python's Life of Brian 81 --- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---