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!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!212.27.60.64.MISMATCH!cleanfeed3-b.proxad.net!nnrp6-1.free.fr!not-for-mail Subject: Re: OpenToken : accessing the lexeme from synthetize Newsgroups: comp.lang.ada References: <0860b74f-2572-4e64-b71a-9812d79b29bb@googlegroups.com> From: Lionel Draghi Date: Sun, 2 Jul 2017 02:01:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <0860b74f-2572-4e64-b71a-9812d79b29bb@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <595837bd$0$3363$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 02 Jul 2017 02:01:01 CEST NNTP-Posting-Host: 82.236.216.140 X-Trace: 1498953661 news-1.free.fr 3363 82.236.216.140:39354 X-Complaints-To: abuse@proxad.net Xref: news.eternal-september.org comp.lang.ada:47255 Date: 2017-07-02T02:01:01+02:00 List-Id: Le 02/07/2017 à 00:20, Lionel Draghi a écrit : > Hi, > I suppose it’s obvious, but I couldn't find a way to get the lexeme image within a synthetize procedure. > > procedure Action > (New_Token : out Nonterminal.Class; > Source : in Token_List.Instance'Class; > To_ID : in Token_ID_Type) > is > Left : constant Token_List.List_Iterator := Token_List.Initial_Iterator (Source); > – the identifier I want to diplay is the first token in the list > Tk : Master_Token.Class := Token_List.Token_Handle (Left).all; > begin > – and now? > Ada.Text_IO.Put_Line (…); > end Action; > > Any help? TIA. > OK, got it : I did not give the Enumerated.Identifier.Get to the defaulted OpenToken.Recognizer.Identifier.Get New_Token parameter ! Same trap than Jacob Sparre Andersen here https://groups.google.com/d/msg/comp.lang.ada/srIozAdn-2E/1srxULptGU4J I wouldn’t have understood this by myself, far too complex. procedure Action (New_Token : out Nonterminal.Class; Source : in Token_List.Instance'Class; To_ID : in Token_ID_Type) is Left : constant Token_List.List_Iterator := Token_List.Initial_Iterator (Source); begin Ada.Text_IO.Put_Line ( To_String (Identifiers.Instance ( Token_List.Token_Handle (Left).all).Identifier)); end Action; -- not compiled code BTW, is there a simpler way to get the identifier ? Sounds still complex to me this way.