comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class
Date: Tue, 13 Feb 2018 12:19:47 -0800 (PST)
Date: 2018-02-13T12:19:47-08:00	[thread overview]
Message-ID: <fe53bf8c-f450-4cd2-8d34-f1f96f4f7ded@googlegroups.com> (raw)
In-Reply-To: <p5v89f$2el$2@dont-email.me>

> 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

Something strange happen and operators are not recorded.
In desperation, I published the whole code (I'll change it according to your advice. I think you would need only the second, four and third (to have an 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

  reply	other threads:[~2018-02-13 20:19 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 [this message]
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
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