comp.lang.ada
 help / color / mirror / Atom feed
From: Bojan Bozovic <bozovic.bojan@gmail.com>
Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class
Date: Tue, 13 Feb 2018 23:00:59 -0800 (PST)
Date: 2018-02-13T23:00:59-08:00	[thread overview]
Message-ID: <66ff85f0-0550-4568-afe9-49eb85e6ab55@googlegroups.com> (raw)
In-Reply-To: <d4474dcd-d26b-4103-961c-bfc9b97d8b45@googlegroups.com>

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 used 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 in the next one ?
> 
> I found that THAT piece, that part of the case statement in the analysis part, is NEVER walked through. I don't get it.
> 
> when '1' .. '9' =>
>   declare
>     FIRST, FIN : NATURAL := 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) := new T_Token_Operande'(TO_TOKEN (INTEGER'Value (CHAINE (FIRST .. FIN))));
>         INDEX_COURANT := FIN;
>    exception when others => PUT_LINE ("HERE !");    
> 
> The input:
> root@debian:~/td travail 18/essai# ./expression < test.in
> 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�e
>  5 5 5Syntaxe pass�e
> 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'Last and cause exception when returning v(index).all.


  reply	other threads:[~2018-02-14  7:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 16:29 troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class Mehdi Saada
2018-02-12 17:44 ` Jeffrey R. Carter
2018-02-12 18:17   ` Mehdi Saada
2018-02-12 18:24     ` Dmitry A. Kazakov
2018-02-12 18:42       ` Simon Wright
2018-02-12 20:25     ` Jeffrey R. Carter
2018-02-12 21:18       ` Mehdi Saada
2018-02-12 22:40         ` Simon Wright
2018-02-12 23:12           ` Mehdi Saada
2018-02-13  8:00         ` Stephen Leake
2018-02-13 17:42         ` Jeffrey R. Carter
2018-02-13 17:56           ` Dmitry A. Kazakov
2018-02-12 21:19       ` Mehdi Saada
2018-02-12 18:40   ` Simon Wright
2018-02-12 21:39 ` Mehdi Saada
2018-02-12 21:43 ` Mehdi Saada
2018-02-12 22:22   ` Mehdi Saada
2018-02-13 17:46     ` Jeffrey R. Carter
2018-02-13 20:19       ` Mehdi Saada
2018-02-13 21:24         ` Bojan Bozovic
2018-02-13 23:03           ` Mehdi Saada
2018-02-13 23:03             ` Mehdi Saada
2018-02-14  7:00               ` Bojan Bozovic [this message]
2018-02-14 12:04                 ` Mehdi Saada
2018-02-16 23:40                   ` Mehdi Saada
2018-02-17  1:13                     ` Mehdi Saada
2018-02-13  0:01 ` Mehdi Saada
2018-02-13  0:42   ` Mehdi Saada
2018-02-13  1:32     ` Mehdi Saada
2018-02-13  4:16       ` Bojan Bozovic
2018-02-13 11:28       ` Simon Wright
2018-02-13 12:03         ` Mehdi Saada
2018-02-13 13:25         ` Dmitry A. Kazakov
2018-02-19 18:10 ` Mehdi Saada
2018-02-19 18:16   ` Simon Clubley
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox