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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class Date: Tue, 13 Feb 2018 14:25:24 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <634e9064-33f8-42c0-9032-e630f98c89d4@googlegroups.com> <5f36f0ae-87ed-4482-9766-561b63b1d343@googlegroups.com> <58302fb3-4b2d-4651-82ca-1efa0b2de8f3@googlegroups.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:50419 Date: 2018-02-13T14:25:24+01:00 List-Id: On 13/02/2018 12:28, Simon Wright wrote: > 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, Right. A source location object would be even better. Actually there is no need to keep tokens anywhere because the corresponding lexical calls can de done immediately. > Of course that wouldn't cover what to > do with numeric or operator tokens. Or those parentheses. These do not apply to tokens anyway, it is too early to decide at the lexical analyze stage. Literals and names/calls/indices come later when all tokens are already gone. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de