From: Lionel Draghi <Lionel.nospam.Draghi@Ada-France.org>
Subject: Re: OpenToken : accessing the lexeme from synthetize
Date: Sun, 2 Jul 2017 02:01:00 +0200
Date: 2017-07-02T02:01:01+02:00 [thread overview]
Message-ID: <595837bd$0$3363$426a74cc@news.free.fr> (raw)
In-Reply-To: <0860b74f-2572-4e64-b71a-9812d79b29bb@googlegroups.com>
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.
next prev parent reply other threads:[~2017-07-02 0:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-01 22:20 OpenToken : accessing the lexeme from synthetize Lionel Draghi
2017-07-02 0:01 ` Lionel Draghi [this message]
2017-07-02 16:50 ` Stephen Leake
2017-07-07 21:31 ` Lionel Draghi
2017-07-08 13:20 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox