File: .lake/packages/lean4/src/lean/Lean/Parser/Extra.lean

full_name: Lean.Parser.optional
code: /-- The parser `optional(p)`, or `(p)?`, parses `p` if it succeeds,
otherwise it succeeds with no value.

Note that because `?` is a legal identifier character, one must write `(p)?` or `p ?` for
it to parse correctly. `ident?` will not work; one must write `(ident)?` instead.

This parser has arity 1: it produces a `nullKind` node containing either zero arguments
(for the `none` case) or the list of arguments produced by `p`.
(In particular, if `p` has arity 0 then the two cases are not differentiated!) -/
@[run_builtin_parser_attribute_hooks] def optional (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.many
code: /-- The parser `many(p)`, or `p*`, repeats `p` until it fails, and returns the list of results.

The argument `p` is "auto-grouped", meaning that if the arity is greater than 1 it will be
automatically replaced by `group(p)` to ensure that it produces exactly 1 value.

This parser has arity 1: it produces a `nullKind` node containing one argument for each
invocation of `p` (or `group(p)`). -/
@[run_builtin_parser_attribute_hooks] def many (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.many1
code: /-- The parser `many1(p)`, or `p+`, repeats `p` until it fails, and returns the list of results.
`p` must succeed at least once, or this parser will fail.

Note that this parser produces the same parse tree as the `many(p)` / `p*` combinator,
and one matches both `p*` and `p+` using `$[ .. ]*` syntax in a syntax match.
(There is no `$[ .. ]+` syntax.)

The argument `p` is "auto-grouped", meaning that if the arity is greater than 1 it will be
automatically replaced by `group(p)` to ensure that it produces exactly 1 value.

This parser has arity 1: it produces a `nullKind` node containing one argument for each
invocation of `p` (or `group(p)`). -/
@[run_builtin_parser_attribute_hooks] def many1 (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.ident
code: /-- The parser `ident` parses a single identifier, possibly with namespaces, such as `foo` or
`bar.baz`. The identifier must not be a declared token, so for example it will not match `"def"`
because `def` is a keyword token. Tokens are implicitly declared by using them in string literals
in parser declarations, so `syntax foo := "bla"` will make `bla` no longer legal as an identifier.

Identifiers can contain special characters or keywords if they are escaped using the `«»` characters:
`«def»` is an identifier named `def`, and `«x»` is treated the same as `x`. This is useful for
using disallowed characters in identifiers such as `«foo.bar».baz` or `«hello world»`.

This parser has arity 1: it produces a `Syntax.ident` node containing the parsed identifier.
You can use `TSyntax.getId` to extract the name from the resulting syntax object. -/
@[run_builtin_parser_attribute_hooks] def ident : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.identWithPartialTrailingDot
code: @[run_builtin_parser_attribute_hooks] def identWithPartialTrailingDot 
goal: Lean.Parser.Parser

full_name: Lean.Parser.rawIdent
code: @[run_builtin_parser_attribute_hooks] def rawIdent : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.hygieneInfo
code: /-- The parser `hygieneInfo` parses no text, but captures the current macro scope information
as though it parsed an identifier at the current position. It returns a `hygieneInfoKind` node
around an `.ident` which is `Name.anonymous` but with macro scopes like a regular identifier.

This is used to implement `have := ...` syntax: the `hygieneInfo` between the `have` and `:=`
substitutes for the identifier which would normally go there as in `have x :=`, so that we
can expand `have :=` to `have this :=` while retaining the usual macro name resolution behavior.
See [doc/macro_overview.md](https://github.com/leanprover/lean4/blob/master/doc/macro_overview.md)
for more information about macro hygiene.

This parser has arity 1: it produces a `Syntax.ident` node containing the parsed identifier.
You can use `TSyntax.getHygieneInfo` to extract the name from the resulting syntax object. -/
@[run_builtin_parser_attribute_hooks] def hygieneInfo : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.numLit
code: /-- The parser `num` parses a numeric literal in several bases:

* Decimal: `129`
* Hexadecimal: `0xdeadbeef`
* Octal: `0o755`
* Binary: `0b1101`

This parser has arity 1: it produces a `numLitKind` node containing an atom with the text of the
literal.
You can use `TSyntax.getNat` to extract the number from the resulting syntax object. -/
@[run_builtin_parser_attribute_hooks] def numLit : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.scientificLit
code: /-- The parser `scientific` parses a scientific-notation literal, such as `1.3e-24`.

This parser has arity 1: it produces a `scientificLitKind` node containing an atom with the text
of the literal.
You can use `TSyntax.getScientific` to extract the parts from the resulting syntax object. -/
@[run_builtin_parser_attribute_hooks] def scientificLit : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.strLit
code: /-- The parser `str` parses a string literal, such as `"foo"` or `"\r\n"`. Strings can contain
C-style escapes like `\n`, `\"`, `\x00` or `\u2665`, as well as literal unicode characters like `∈`.
Newlines in a string are interpreted literally.

This parser has arity 1: it produces a `strLitKind` node containing an atom with the raw
literal (including the quote marks and without interpreting the escapes).
You can use `TSyntax.getString` to decode the string from the resulting syntax object. -/
@[run_builtin_parser_attribute_hooks] def strLit : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.charLit
code: /-- The parser `char` parses a character literal, such as `'a'` or `'\n'`. Character literals can
contain C-style escapes like `\n`, `\"`, `\x00` or `\u2665`, as well as literal unicode characters
like `∈`, but must evaluate to a single unicode codepoint, so `'♥'` is allowed but `'❤️'` is not
(since it is two codepoints but one grapheme cluster).

This parser has arity 1: it produces a `charLitKind` node containing an atom with the raw
literal (including the quote marks and without interpreting the escapes).
You can use `TSyntax.getChar` to decode the string from the resulting syntax object. -/
@[run_builtin_parser_attribute_hooks] def charLit : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.nameLit
code: /-- The parser `name` parses a name literal like `` `foo``. The syntax is the same as for identifiers
(see `ident`) but with a leading backquote.

This parser has arity 1: it produces a `nameLitKind` node containing the raw literal
(including the backquote).
You can use `TSyntax.getName` to extract the name from the resulting syntax object. -/
@[run_builtin_parser_attribute_hooks] def nameLit : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.group
code: /-- The parser `group(p)` parses the same thing as `p`, but it wraps the results in a `groupKind`
node.

This parser always has arity 1, even if `p` does not. Parsers like `p*` are automatically
rewritten to `group(p)*` if `p` does not have arity 1, so that the results from separate invocations
of `p` can be differentiated. -/
@[run_builtin_parser_attribute_hooks, inline] def group (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.many1Indent
code: /-- The parser `many1Indent(p)` is equivalent to `withPosition((colGe p)+)`. This has the effect of
parsing one or more occurrences of `p`, where each subsequent `p` parse needs to be indented
the same or more than the first parse.

This parser has arity 1, and returns a list of the results from `p`.
`p` is "auto-grouped" if it is not arity 1. -/
@[run_builtin_parser_attribute_hooks, inline] def many1Indent (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.manyIndent
code: /-- The parser `manyIndent(p)` is equivalent to `withPosition((colGe p)*)`. This has the effect of
parsing zero or more occurrences of `p`, where each subsequent `p` parse needs to be indented
the same or more than the first parse.

This parser has arity 1, and returns a list of the results from `p`.
`p` is "auto-grouped" if it is not arity 1. -/
@[run_builtin_parser_attribute_hooks, inline] def manyIndent (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.sepByIndent
code: @[inline] def sepByIndent (p : Parser) (sep : String) (psep : Parser := symbol sep) (allowTrailingSep : Bool := false) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.sepBy1Indent
code: @[inline] def sepBy1Indent (p : Parser) (sep : String) (psep : Parser := symbol sep) (allowTrailingSep : Bool := false) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.sepByIndent.formatter
code: @[combinator_formatter sepByIndent]
def sepByIndent.formatter (p : Formatter) (_sep : String) (pSep : Formatter) : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.Parser.sepBy1Indent.formatter
code: @[combinator_formatter sepBy1Indent] def sepBy1Indent.formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.Parser.notSymbol
code: @[run_builtin_parser_attribute_hooks] abbrev notSymbol (s : String) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.patternIgnore
code: /-- No-op parser combinator that annotates subtrees to be ignored in syntax patterns. -/
@[inline, run_builtin_parser_attribute_hooks] def patternIgnore : Parser → Parser 
goal: Lean.Parser.Parser → Lean.Parser.Parser

full_name: Lean.Parser.ppHardSpace
code: /-- No-op parser that advises the pretty printer to emit a non-breaking space. -/
@[inline] def ppHardSpace : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.ppSpace
code: /-- No-op parser that advises the pretty printer to emit a space/soft line break. -/
@[inline] def ppSpace : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.ppLine
code: /-- No-op parser that advises the pretty printer to emit a hard line break. -/
@[inline] def ppLine : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.ppRealFill
code: /-- No-op parser combinator that advises the pretty printer to emit a `Format.fill` node. -/
@[inline] def ppRealFill : Parser → Parser 
goal: Lean.Parser.Parser → Lean.Parser.Parser

full_name: Lean.Parser.ppRealGroup
code: /-- No-op parser combinator that advises the pretty printer to emit a `Format.group` node. -/
@[inline] def ppRealGroup : Parser → Parser 
goal: Lean.Parser.Parser → Lean.Parser.Parser

full_name: Lean.Parser.ppIndent
code: /-- No-op parser combinator that advises the pretty printer to indent the given syntax without grouping it. -/
@[inline] def ppIndent : Parser → Parser 
goal: Lean.Parser.Parser → Lean.Parser.Parser

full_name: Lean.Parser.ppGroup
code: /--
  No-op parser combinator that advises the pretty printer to group and indent the given syntax.
  By default, only syntax categories are grouped. -/
@[inline] def ppGroup (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.ppDedent
code: /--
  No-op parser combinator that advises the pretty printer to dedent the given syntax.
  Dedenting can in particular be used to counteract automatic indentation. -/
@[inline] def ppDedent : Parser → Parser 
goal: Lean.Parser.Parser → Lean.Parser.Parser

full_name: Lean.Parser.ppAllowUngrouped
code: /--
  No-op parser combinator that allows the pretty printer to omit the group and
  indent operation in the enclosing category parser.
  ```
  syntax ppAllowUngrouped "by " tacticSeq : term
  -- allows a `by` after `:=` without linebreak in between:
  theorem foo : True := by
    trivial
  ```
-/
@[inline] def ppAllowUngrouped : Parser 
goal: Lean.Parser.Parser

full_name: Lean.Parser.ppDedentIfGrouped
code: /--
  No-op parser combinator that advises the pretty printer to dedent the given syntax,
  if it was grouped by the category parser.
  Dedenting can in particular be used to counteract automatic indentation. -/
@[inline] def ppDedentIfGrouped : Parser → Parser 
goal: Lean.Parser.Parser → Lean.Parser.Parser

full_name: Lean.Parser.ppHardLineUnlessUngrouped
code: /--
  No-op parser combinator that prints a line break.
  The line break is soft if the combinator is followed
  by an ungrouped parser (see ppAllowUngrouped), otherwise hard. -/
@[inline] def ppHardLineUnlessUngrouped : Parser 
goal: Lean.Parser.Parser

full_name: Lean.ppHardSpace.formatter
code: @[combinator_formatter ppHardSpace] def ppHardSpace.formatter : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppSpace.formatter
code: @[combinator_formatter ppSpace] def ppSpace.formatter : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppLine.formatter
code: @[combinator_formatter ppLine] def ppLine.formatter : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppRealFill.formatter
code: @[combinator_formatter ppRealFill] def ppRealFill.formatter (p : Formatter) : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppRealGroup.formatter
code: @[combinator_formatter ppRealGroup] def ppRealGroup.formatter (p : Formatter) : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppIndent.formatter
code: @[combinator_formatter ppIndent] def ppIndent.formatter (p : Formatter) : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppDedent.formatter
code: @[combinator_formatter ppDedent] def ppDedent.formatter (p : Formatter) : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppAllowUngrouped.formatter
code: @[combinator_formatter ppAllowUngrouped] def ppAllowUngrouped.formatter : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppDedentIfGrouped.formatter
code: @[combinator_formatter ppDedentIfGrouped] def ppDedentIfGrouped.formatter (p : Formatter) : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.ppHardLineUnlessUngrouped.formatter
code: @[combinator_formatter ppHardLineUnlessUngrouped] def ppHardLineUnlessUngrouped.formatter : Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Lean.Parser.«termRegister_parser_alias(Kind:=_)______»
code: syntax "register_parser_alias " group("(" &"kind" " := " term ") ")? (strLit ppSpace)? ident (ppSpace colGt term)? : term
goal: Lean.ParserDescr

full_name: Lean.Parser.«_aux_.lake_packages_lean4_src_lean_Lean_Parser_Extra___macroRules_Lean_Parser_termRegister_parser_alias(Kind:=_)_______1»
code: macro_rules
  | `(register_parser_alias $[(kind := $kind?)]? $(aliasName?)? $declName $(info?)?) => do
    let [(fullDeclName, [])] ← Macro.resolveGlobalName declName.getId |
      Macro.throwError "expected non-overloaded constant name"
    let aliasName := match aliasName? with
      | some n => quote (Name.mkSimple n.getString)
      | none => quote declName.getId
    `(do Parser.registerAlias $aliasName ``$declName $declName $(info?.getD (Unhygienic.run `({}))) (kind? := some $(kind?.getD (quote fullDeclName)))
         PrettyPrinter.Formatter.registerAlias $aliasName $(mkIdentFrom declName (declName.getId ++ `formatter))
         PrettyPrinter.Parenthesizer.registerAlias $aliasName $(mkIdentFrom declName (declName.getId ++ `parenthesizer)))
goal: Lean.Macro

full_name: Lean.Parser.initFn._@..lake.packages.lean4.src.lean.Lean.Parser.Extra._hyg.1790
code: builtin_initialize
  register_parser_alias patternIgnore { autoGroupArgs := false }

  register_parser_alias group { autoGroupArgs := false }
  register_parser_alias ppHardSpace { stackSz? := some 0 }
  register_parser_alias ppSpace { stackSz? := some 0 }
  register_parser_alias ppLine { stackSz? := some 0 }
  register_parser_alias ppGroup { stackSz? := none }
  register_parser_alias ppRealGroup { stackSz? := none }
  register_parser_alias ppRealFill { stackSz? := none }
  register_parser_alias ppIndent { stackSz? := none }
  register_parser_alias ppDedent { stackSz? := none }
  register_parser_alias ppDedentIfGrouped { stackSz? := none }
  register_parser_alias ppAllowUngrouped { stackSz? := some 0 }
  register_parser_alias ppHardLineUnlessUngrouped { stackSz? := some 0 }
goal: IO Unit