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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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 im2mr3078455pbc.3.1326534675509; Sat, 14 Jan 2012 01:51:15 -0800 (PST) Path: lh20ni180686pbb.0!nntp.google.com!news2.google.com!news.glorb.com!feeder.erje.net!news2.arglkargh.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Data_Error and Enumeration_IO Date: Sat, 14 Jan 2012 10:51:06 +0100 Organization: cbb software GmbH Message-ID: <1gv8onztmplct$.1plcq438hgmof$.dlg@40tude.net> References: <3f3d626a-1b8c-49af-aa85-9e586029a817@z12g2000yqm.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: PPt+vSuBRqtkVsMLa1J3Dg.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-01-14T10:51:06+01:00 List-Id: On Fri, 13 Jan 2012 18:09:48 -0600, Randy Brukardt wrote: > As to why it is done this way, it's hard to imagine how else it could be > done. To reject the "abc" example at the 'a', for instance, we would have to > do a brute force search in a table of potentially hundreds of enumeration > literals to see if any start with 'a', then repeat that to see if any start > with "ab", and so on. If the literals are long and the number of literals is > high, this is going to be a N**2 algorithm -- and I don't think I want my > input to do that (there is a built-in denial of service possibility). You have the enumeration type when you are reading its literal. The actual problem is looking ahead or returning an unbounded number of characters back. The advantage of using strings is that you can easily maintain the policy that on any error the cursor is not moved. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de