Zulip Chat Archive
Stream: Is there code for X?
Topic: declId to ident / id
Adam Topaz (Oct 07 2024 at 13:34):
I am working with some TSyntax
object of the form TSyntax `Lean.Parser.Command.declId
. This has an identifier buried somewhere inside, plus potentially some universe annotations. Do we have a convenient way to extract the ident
, or the identifier itself as a Name
? If not, then what is the preferred way to obtain the identifier?
Damiano Testa (Oct 07 2024 at 13:35):
does id[0].getId
work for you?
Damiano Testa (Oct 07 2024 at 13:35):
id[0]
should be the "plain" identifier.
Adam Topaz (Oct 07 2024 at 13:36):
is there a getElem
instance for TSyntax
?
Damiano Testa (Oct 07 2024 at 13:36):
Oh, possibly laundering it through .raw
?
Adam Topaz (Oct 07 2024 at 13:36):
But then I can't use getId
Damiano Testa (Oct 07 2024 at 13:36):
So, id.raw[0].getId
.
Adam Topaz (Oct 07 2024 at 13:37):
Oh that does work! Thanks!
Damiano Testa (Oct 07 2024 at 13:37):
I think that it might work, just give "unexpected behaviour" if you give a non-ident.
Adam Topaz (Oct 07 2024 at 13:37):
Thanks! You are a syntax guru!
Damiano Testa (Oct 07 2024 at 13:38):
I'll take the compliment, but still am skeptical... :smile:
Last updated: May 02 2025 at 03:31 UTC