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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class Date: Tue, 13 Feb 2018 11:28:17 +0000 Organization: A noiseless patient Spider Message-ID: References: <634e9064-33f8-42c0-9032-e630f98c89d4@googlegroups.com> <5f36f0ae-87ed-4482-9766-561b63b1d343@googlegroups.com> <58302fb3-4b2d-4651-82ca-1efa0b2de8f3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="0b852e40190820e0f08a03d313e97d15"; logging-data="822"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pPV9KdjndYmls8C/pGcsHm8wlzUUR9Pw=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:QpnGK3shm6j9SpB9r02eov6gxSw= sha1:N4JNW8qRQmMi5tQZATLAszqzabs= Xref: reader02.eternal-september.org comp.lang.ada:50416 Date: 2018-02-13T11:28:17+00:00 List-Id: Mehdi Saada <00120260a@gmail.com> writes: > case ELEMENT is > when '(' => V_LOCAL (I) := new T_TOKEN_PARENTHESE'(La_Parenthese => '('); > when ')' => V_LOCAL (I) := new T_TOKEN_PARENTHESE'(La_Parenthese => ')'); > when ';' => V_LOCAL (I) := new T_TOKEN_TERMINATEUR'(Le_Terminateur => ';'); > when '+' | '-' | '*' | '/' => > V_LOCAL (I) := new T_Token_Operateur'(L_Operateur => T_Operateur'Value (STRING'(1 => ELEMENT))); Well, I would make T_TOKEN contain the first and last indices of the token in the input string if it'll still be available, or else an Unbounded_String containing the token text. That way you could probably avoid a lot of these differences. Of course that wouldn't cover what to do with numeric or operator tokens. Or those parentheses.