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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.107.222.25 with SMTP id v25mr1691921iog.103.1518553188284; Tue, 13 Feb 2018 12:19:48 -0800 (PST) X-Received: by 10.157.40.82 with SMTP id h18mr79040otd.13.1518553188039; Tue, 13 Feb 2018 12:19:48 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!w142no1478127ita.0!news-out.google.com!m16ni3737itm.0!nntp.google.com!o66no1468637ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 13 Feb 2018 12:19:47 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.242.254.95; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.242.254.95 References: <634e9064-33f8-42c0-9032-e630f98c89d4@googlegroups.com> <1d7b8c25-b206-4ad0-b3ab-1ee1b8b34dc8@googlegroups.com> <29277750-1fc5-4d1d-96d4-a3ac9b5ec755@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Tue, 13 Feb 2018 20:19:48 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:50428 Date: 2018-02-13T12:19:47-08:00 List-Id: > 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 p= ointless. I wouldn't use OOP to begin with, if it was me. Plus, I never use= d containers, so it would be more work/new things, and that's already an aw= ful 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 in = the next one ? I found that THAT piece, that part of the case statement in the analysis pa= rt, is NEVER walked through. I don't get it. when '1' .. '9' =3D> declare FIRST, FIN : NATURAL :=3D 0; begin Find_Token (CHAINE, TO_SET ("123456789"), INDEX_COURANT, INSIDE, First, FI= N); PUT_LINE("LONG_VEC_OUT: " & INTEGER'Image(LONG_VEC_OUT) & " INDEX_C= OURANT:" & INTEGER'Image(INDEX_COURANT)); V (LONG_VEC_OUT) :=3D new T_Token_Operande'(TO_TOKEN (INTEGER'Value= (CHAINE (FIRST .. FIN))));=20 INDEX_COURANT :=3D FIN; exception when others =3D> PUT_LINE ("HERE !"); =20 The input: root@debian:~/td travail 18/essai# ./expression < test.in=20 45+454; 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=20 erreur de syntaxe Something strange happen and operators are not recorded. In desperation, I published the whole code (I'll change it according to you= r advice. I think you would need only the second, four and third (to have a= n exemple). expression.adb (the test) ! https://pastebin.com/ix2YVrCE p_expression.adb : https://pastebin.com/i9AAgdwQ p_expression.ads : https://pastebin.com/Tkba3hJx p_token.ads : https://pastebin.com/gJT7ggpp p_token-operande.adb : https://pastebin.com/nL1SrAP9 p_token-operande.ads : https://pastebin.com/eCKgaaBS p_token-operateur.adb : https://pastebin.com/3EsUeVDp p_token-operateur.ads : https://pastebin.com/0dLJjRvB p_token-parenthese.adb : https://pastebin.com/0L7sN7bF p_token-parenthese.ads : https://pastebin.com/GqFfzfTM p_token-terminateur.ads : https://pastebin.com/gcpNpuR5 p_token-terminateur.adb : https://pastebin.com/PPZSXC3R