Zulip Chat Archive
Stream: lean4
Topic: Confusing syntax match
Wojciech Nawrocki (Jul 21 2022 at 21:03):
I am a bit baffled by the following error. Screenshot instead of text since the error span is on the exact expected symbol.
Sebastian Ullrich (Jul 21 2022 at 21:05):
@Wojciech Nawrocki Ah, that's unfortunate. Tokens are registered only when a surrounding parser is hooked into a parser category. So at this point, blocking
is still an identifier.
Wojciech Nawrocki (Jul 21 2022 at 21:09):
@Sebastian Ullrich what does it mean for a surrounding parser to be hooked into a parser category? The #xy is that I would like to use this in a tactic like
syntax "specialize_def" ident "[" term,* "]" optional(blockingConsts) : tactic
Should I invent a fake syntax category or ..?
Sebastian Ullrich (Jul 21 2022 at 21:10):
At that point it is hooked into the tactic
category :) . You just need to move that line up above foo
Wojciech Nawrocki (Jul 21 2022 at 21:12):
Ah I see, but it doesn't work with elab
:
syntax blockingConsts := "blocking" "[" ident,* "]"
elab "specialize_def" i:ident "[" ts:term,* "]" block?:optional(blockingConsts) : tactic => do
/- expected 'blocking' -/
if let `(blockingConsts|blocking [ $is:ident,* ]) := block? then
sorry
sorry
Sebastian Ullrich (Jul 21 2022 at 21:13):
Ahh, yeah, the generated parser is registered only after the entire command has been parsed
Last updated: Dec 20 2023 at 11:08 UTC