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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.149.20 with SMTP id x20mr2783014iod.101.1518591660229; Tue, 13 Feb 2018 23:01:00 -0800 (PST) X-Received: by 10.157.71.25 with SMTP id a25mr120296otf.3.1518591660070; Tue, 13 Feb 2018 23:01:00 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!tncsrv06.tnetconsulting.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!o66no1610090ita.0!news-out.google.com!m16ni4400itm.0!nntp.google.com!o66no1610087ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 13 Feb 2018 23:00:59 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=87.116.179.50; posting-account=z-xFXQkAAABpEOAnT3LViyFXc8dmoW_p NNTP-Posting-Host: 87.116.179.50 References: <634e9064-33f8-42c0-9032-e630f98c89d4@googlegroups.com> <1d7b8c25-b206-4ad0-b3ab-1ee1b8b34dc8@googlegroups.com> <29277750-1fc5-4d1d-96d4-a3ac9b5ec755@googlegroups.com> <03f8711d-bca3-4389-b980-d0abc308c719@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <66ff85f0-0550-4568-afe9-49eb85e6ab55@googlegroups.com> Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class From: Bojan Bozovic Injection-Date: Wed, 14 Feb 2018 07:01:00 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:50439 Date: 2018-02-13T23:00:59-08:00 List-Id: On Wednesday, February 14, 2018 at 12:03:35 AM UTC+1, Mehdi Saada wrote: > > Why? An Indefinite_Vector of T_Token'Class would be better. > Because it's my course, and I can rewrite the whole thing, or it would be= pointless. I wouldn't use OOP to begin with, if it was me. Plus, I never u= sed containers, so it would be more work/new things, and that's already an = awful lot at once. And I would really miss the built-in array slice syntax.= I long for the day they add this for containers in the norm. Is it meant i= n the next one ? >=20 > I found that THAT piece, that part of the case statement in the analysis = part, is NEVER walked through. I don't get it. >=20 > when '1' .. '9' =3D> > declare > FIRST, FIN : NATURAL :=3D 0; > begin > Find_Token (CHAINE, TO_SET ("123456789"), INDEX_COURANT, INSIDE, = First, FIN); > PUT_LINE("LONG_VEC_OUT: " & INTEGER'Image(LONG_VEC_OUT) & " INDEX= _COURANT:" & INTEGER'Image(INDEX_COURANT)); > V (LONG_VEC_OUT) :=3D new T_Token_Operande'(TO_TOKEN (INTEGER'Val= ue (CHAINE (FIRST .. FIN)))); > INDEX_COURANT :=3D FIN; > exception when others =3D> PUT_LINE ("HERE !"); =20 >=20 > The input: > root@debian:~/td travail 18/essai# ./expression < test.in > 45+454; >=20 > LONG_VEC_OUT: 1 INDEX_COURANT: 1 > LONG_VEC_OUT: 2 INDEX_COURANT: 3 > LONG_VEC_OUT: 3 INDEX_COURANT: 7 > ICI ! > Analyse pass=EF=BF=BDe > 5 5 5Syntaxe pass=EF=BF=BDe > erreur de syntaxe I get CONSTRAINT_ERROR in p_expression.adb function TOKEN_COURANT. Rethink = the whole Syntaxe procedure use loop ...... exit when Condition; end loop; = (repeat ... until), because TOKEN_COURANT will increase INDEX beyound V'Las= t and cause exception when returning v(index).all.