Zulip Chat Archive

Stream: lean4

Topic: manyIndent


Mac (Sep 20 2021 at 00:59):

Why does the manyIndent parser not work in syntax?

import Lean.Parser
open Lean Parser

#check manyIndent -- manyIndent : Parser → Parser
syntax foo := manyIndent(group(term ","?)) -- Error: parser 'manyIndent' was not found

Sebastian Ullrich (Sep 20 2021 at 08:33):

short answer: Parser combinators cannot be used directly, they must be registered via register_parser_alias. But I suppose all ingredients to reimplement it are exposed.

Mac (Sep 20 2021 at 08:37):

@Sebastian Ullrich Could we get parser aliases for manyIndent/many1Indent in core? They seem quite useful for DSLs that want custom do or structure like syntax.

Mac (Sep 20 2021 at 08:39):

While,, as you mentioned, they can be replicated in downstream code already, that seems like somewhat unnecessary code duplication.

Sebastian Ullrich (Sep 20 2021 at 11:20):

done


Last updated: Dec 20 2023 at 11:08 UTC