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: 103376,64d33c985c8959f0 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.42.155.2 with SMTP id s2mr24142476icw.5.1320449512073; Fri, 04 Nov 2011 16:31:52 -0700 (PDT) Path: p6ni71925pbn.0!nntp.google.com!news2.google.com!postnews.google.com!p16g2000yqd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: How does Ada.Text_IO.Enumeration_IO work? Date: Fri, 4 Nov 2011 16:31:33 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <865d6298-5a0b-45c5-b0fc-372d6222752f@z22g2000prd.googlegroups.com> <7223b173-df96-4a12-82c0-268b7512e958@j36g2000prh.googlegroups.com> <67163342-cdc1-427d-9267-c41b51c9e08f@a12g2000vbz.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1320449505 7950 127.0.0.1 (4 Nov 2011 23:31:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Nov 2011 23:31:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p16g2000yqd.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: news2.google.com comp.lang.ada:14320 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-11-04T16:31:33-07:00 List-Id: On Nov 4, 3:46=A0pm, Jerry wrote: > > 'Cuz the rules say so. =A0A.10.6(5) is the important one here: "Next, > > characters are input only so long as the sequence input is an initial > > sequence of an identifier or of a character literal (in particular, > > input ceases when a line terminator is encountered). The character or > > line terminator that causes input to cease remains available for > > subsequent input." =A0A.10.6(10): "The exception Data_Error is > > propagated by a Get procedure if the sequence finally input is not a > > lexical element corresponding to the type, in particular if no > > characters were input ...". =A0That's the case when your input (skippin= g > > leading blanks) starts with an invalid character like a comma. =A0Since > > the comma can't be the first character of an enumeration literal, the > > comma "remains available for subsequent input", and thus "no > > characters are input" and Data_Error is raised. > > Thanks, Adam. I believe that the clue for me is that "remains > available for subsequent input" means that it is available only to non- > enumeration input, characters excepted. I'm not sure what you mean by this. If the first character in the input (other than space) cannot be the start of an enumeration literal, the input will stop right there; and that character remains available in the input. If you then try to perform input using Enumeration_IO (without any other input routines in between), that same character is "available" in the input but causes Enumeration_IO to fail again for the same reason. Perhaps there's some confusion about what the RM means by "available". "The character remains available for subsequent input" means that *any* input routine will see that character first (and could raise an exception if that character is not legal). It doesn't mean that the input routine will succeed. But you could suck the character up with Text_IO.Get (to get one character), and then the character isn't available for input any more. I hope this doesn't confuse you more, but I couldn't tell from your comment whether things were clear to you; and if not, I was hoping to try to make it clearer. -- Adam