Zulip Chat Archive

Stream: lean4

Topic: custom error message for syntax category expectation


Thomas Murrills (Feb 05 2023 at 23:19):

If I have a syntax category

declare_syntax_cat foo
syntax "a" <|> "b" : foo -- or some other syntax, details unimportant

declare_syntax_cat bar
syntax "bar! " foo : tactic

then when I type bar! c in a tactic, I'll see "expected foo" as an error message.

I'd like to manually change this error message for foo so that it's more descriptive—e.g. "expected 'a' or 'b'". Is there a way to do that?

Sebastian Ullrich (Feb 06 2023 at 08:57):

That would seem to contradict the extensibility of syntax categories. Use syntax foo := "a" <|> "b" if you don't need that.


Last updated: Dec 20 2023 at 11:08 UTC