Zulip Chat Archive
Stream: general
Topic: ident_ parser
Johan Commelin (Oct 07 2021 at 14:02):
We have
/-- Parse an identifier or a '_' -/
meta def ident_ : parser name := ident <|> tk "_" *> return `_
Would it be possible to make this parser also accept French-quoted hypotheses such as ‹x ≠ y›
?
Eric Wieser (Oct 07 2021 at 14:09):
That wouldn't be a parser name
any more
Eric Wieser (Oct 07 2021 at 14:10):
What would intro ‹x ≠ y›
mean?
Johan Commelin (Oct 07 2021 at 14:10):
Hmm, that makes sense.
Johan Commelin (Oct 07 2021 at 14:11):
So I guess I want a new kind of parser, that takes a name or a french quoted thingy.
Eric Wieser (Oct 07 2021 at 14:11):
If this is regarding library_search
, then it sounds like the problem is you're parsing a name but should be parsing an expression
Eric Wieser (Oct 07 2021 at 14:11):
Presumbly h x
should be valid in your intended use case too?
Johan Commelin (Oct 07 2021 at 14:12):
hmmz, probably. This is quickly becoming too meta
. But I guess library_search using [h x]
is reasonable.
Eric Wieser (Oct 07 2021 at 14:14):
how does tactic#simpa parse the using
clause?
Eric Wieser (Oct 07 2021 at 14:14):
I think that's what you want here
Rob Lewis (Oct 07 2021 at 14:14):
library_search using [t1, t2]
should probably just add t1
, t2
to the context if they aren't local constants already, then you don't have to change the main function at all
Eric Wieser (Oct 07 2021 at 14:16):
Would we need the kinda of metavariable avoidance used by simpa
here?
Johan Commelin (Oct 07 2021 at 14:17):
But library_search
needs to filter it's results to see if they make use of t1
and t2
. Is that easy if they are arbitrary expressions?
Rob Lewis (Oct 07 2021 at 14:18):
Parse an optional tk "using" >> pexpr_list
, elaborate the list, note_anon
anything in the list that isn't a local constant. Then you just have a list of local constants
Johan Commelin (Oct 07 2021 at 14:18):
If you say so... :rofl:
Rob Lewis (Oct 07 2021 at 14:31):
Actually, this will cause trouble when it prints out what it finds at the end
Last updated: Dec 20 2023 at 11:08 UTC