Zulip Chat Archive

Stream: lean4

Topic: parse Name containing .num


Marcus Rossel (Dec 02 2023 at 14:31):

What's the best way to parse a Name? Lean's ident parser works fine for things like a.b.c, but as soon as a number is involved (as in a.1), it fails.

Shreyas Srinivas (Dec 02 2023 at 15:30):

There is a name parser. Does it work?

Marcus Rossel (Dec 02 2023 at 16:29):

No, it doesn't

Mario Carneiro (Dec 02 2023 at 19:30):

.num components cannot be parsed by the name parser, those are magic internal names that can only be produced with metaprogramming

Mario Carneiro (Dec 02 2023 at 19:32):

That said I have been thinking about making a raw_name% parser which allows a.1 to be parsed. The trouble is that this would not be an ident so you couldn't just use it anywhere an ident is expected, so you would have to resort to the same macro trick I've used previously, and in that case having a special name parser wouldn't help that much


Last updated: Dec 20 2023 at 11:08 UTC