Zulip Chat Archive

Stream: lean4

Topic: Parsing then reassembling syntax


Eric Wieser (Oct 09 2023 at 16:00):

What am I doing wrong here?

syntax "test_sage_output" (&" only")? (" [" term,* "]")? term : tactic

syntax "create_sage_output_test" (&" only")? (" [" term,* "]")? : tactic

elab_rules : tactic
  | `(tactic| create_sage_output_test $[only%$onlyTk]? $[[$hypsStx,*]]?) => do
    let foo := `(tactic| test_sage_output $[only%$onlyTk]? $[[$hypsStx,*]]? sorry)
    sorry

I want foo to be exacty the same syntax but with the first token replaced and the sorry token appended

Eric Wieser (Oct 09 2023 at 16:01):

Is the syntax for pattern matching syntax different to the syntax for building syntax quotations?

Eric Wieser (Oct 09 2023 at 16:02):

And if so, is there a cheat-sheet for translating between one and the other?

Sebastian Ullrich (Oct 09 2023 at 16:05):

A syntax quotation term is a monadic value, you need to bind it


Last updated: Dec 20 2023 at 11:08 UTC