File: .lake/packages/lean4/src/lean/Lean/Syntax.lean

full_name: String.instInhabitedRange
code: /--
A position range inside a string. This type is mostly in combination with syntax trees,
as there might not be a single underlying string in this case that could be used for a `Substring`.
-/
protected structure String.Range where
  start : String.Pos
  stop  : String.Pos
  deriving Inhabited, Repr, BEq, Hashable
goal: Inhabited String.Range

full_name: String.instReprRange
code: /--
A position range inside a string. This type is mostly in combination with syntax trees,
as there might not be a single underlying string in this case that could be used for a `Substring`.
-/
protected structure String.Range where
  start : String.Pos
  stop  : String.Pos
  deriving Inhabited, Repr, BEq, Hashable
goal: Repr String.Range

full_name: String.Range.start
code: /--
A position range inside a string. This type is mostly in combination with syntax trees,
as there might not be a single underlying string in this case that could be used for a `Substring`.
-/
protected structure String.Range where
  start : String.Pos
  stop  : String.Pos
  deriving Inhabited, Repr, BEq, Hashable
goal: String.Pos

full_name: String.instBEqRange
code: /--
A position range inside a string. This type is mostly in combination with syntax trees,
as there might not be a single underlying string in this case that could be used for a `Substring`.
-/
protected structure String.Range where
  start : String.Pos
  stop  : String.Pos
  deriving Inhabited, Repr, BEq, Hashable
goal: BEq String.Range

full_name: String.instHashableRange
code: /--
A position range inside a string. This type is mostly in combination with syntax trees,
as there might not be a single underlying string in this case that could be used for a `Substring`.
-/
protected structure String.Range where
  start : String.Pos
  stop  : String.Pos
  deriving Inhabited, Repr, BEq, Hashable
goal: Hashable String.Range

full_name: String.Range.stop
code: /--
A position range inside a string. This type is mostly in combination with syntax trees,
as there might not be a single underlying string in this case that could be used for a `Substring`.
-/
protected structure String.Range where
  start : String.Pos
  stop  : String.Pos
  deriving Inhabited, Repr, BEq, Hashable
goal: String.Pos

full_name: String.Range
code: /--
A position range inside a string. This type is mostly in combination with syntax trees,
as there might not be a single underlying string in this case that could be used for a `Substring`.
-/
protected structure String.Range where
  start : String.Pos
  stop  : String.Pos
  deriving Inhabited, Repr, BEq, Hashable
goal: Type

full_name: String.Range.contains
code: def String.Range.contains (r : String.Range) (pos : String.Pos) (includeStop := false) : Bool 
goal: Bool

full_name: String.Range.includes
code: def String.Range.includes (super sub : String.Range) : Bool 
goal: Bool

full_name: Lean.SourceInfo.updateTrailing
code: def SourceInfo.updateTrailing (trailing : Substring) : SourceInfo → SourceInfo
  
goal: Lean.SourceInfo → Lean.SourceInfo

full_name: Lean.SourceInfo.getRange?
code: def SourceInfo.getRange? (canonicalOnly := false) (info : SourceInfo) : Option String.Range 
goal: Option String.Range

full_name: Lean.«instBEqSourceInfo_.lake»
code: BEq
goal: BEq Lean.SourceInfo

full_name: Lean.IsNode.mk
code: inductive IsNode : Syntax → Prop where
  | mk (info : SourceInfo) (kind : SyntaxNodeKind) (args : Array Syntax) : IsNode (Syntax.node info kind args)
goal: Lean.IsNode (Lean.Syntax.node info kind args)

full_name: Lean.IsNode
code: inductive IsNode : Syntax → Prop where
  | mk (info : SourceInfo) (kind : SyntaxNodeKind) (args : Array Syntax) : IsNode (Syntax.node info kind args)
goal: Lean.Syntax → Prop

full_name: Lean.SyntaxNode
code: def SyntaxNode : Type 
goal: Type

full_name: Lean.unreachIsNodeMissing
code: def unreachIsNodeMissing {β} : IsNode Syntax.missing → β 
goal: Lean.IsNode Lean.Syntax.missing → β

full_name: Lean.unreachIsNodeAtom
code: def unreachIsNodeAtom {β} {info val} : IsNode (Syntax.atom info val) → β 
goal: Lean.IsNode (Lean.Syntax.atom info val) → β

full_name: Lean.unreachIsNodeIdent
code: def unreachIsNodeIdent {β info rawVal val preresolved} : IsNode (Syntax.ident info rawVal val preresolved) → β 
goal: Lean.IsNode (Lean.Syntax.ident info rawVal val preresolved) → β

full_name: Lean.isLitKind
code: def isLitKind (k : SyntaxNodeKind) : Bool 
goal: Bool

full_name: Lean.SyntaxNode.getKind
code: @[inline] def getKind (n : SyntaxNode) : SyntaxNodeKind 
goal: Lean.SyntaxNodeKind

full_name: Lean.SyntaxNode.withArgs
code: @[inline] def withArgs {β} (n : SyntaxNode) (fn : Array Syntax → β) : β 
goal: β

full_name: Lean.SyntaxNode.getNumArgs
code: @[inline] def getNumArgs (n : SyntaxNode) : Nat 
goal: Nat

full_name: Lean.SyntaxNode.getArg
code: @[inline] def getArg (n : SyntaxNode) (i : Nat) : Syntax 
goal: Lean.Syntax

full_name: Lean.SyntaxNode.getArgs
code: @[inline] def getArgs (n : SyntaxNode) : Array Syntax 
goal: Array Lean.Syntax

full_name: Lean.SyntaxNode.modifyArgs
code: @[inline] def modifyArgs (n : SyntaxNode) (fn : Array Syntax → Array Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.structRangeEq
code: /--
Compares syntax structures and position ranges, but not whitespace. We generally assume that if
syntax trees equal in this way generate the same elaboration output, including positions contained
in e.g. diagnostics and the info tree. However, as we have a few request handlers such as `goalsAt?`
that are sensitive to whitespace information in the info tree, we currently use `eqWithInfo` instead
for reuse checks.
-/
partial def structRangeEq : Syntax → Syntax → Bool
  
goal: Lean.Syntax → Lean.Syntax → Bool

full_name: Lean.Syntax.structRangeEqWithTraceReuse
code: /-- Like `structRangeEq` but prints trace on failure if `trace.Elab.reuse` is activated. -/
def structRangeEqWithTraceReuse (opts : Options) (stx1 stx2 : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.eqWithInfo
code: /-- Full comparison of syntax structures and source infos.  -/
partial def eqWithInfo : Syntax → Syntax → Bool
  
goal: Lean.Syntax → Lean.Syntax → Bool

full_name: Lean.Syntax.eqWithInfoAndTraceReuse
code: /-- Like `eqWithInfo` but prints trace on failure if `trace.Elab.reuse` is activated. -/
def eqWithInfoAndTraceReuse (opts : Options) (stx1 stx2 : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.getAtomVal
code: def getAtomVal : Syntax → String
  
goal: Lean.Syntax → String

full_name: Lean.Syntax.setAtomVal
code: def setAtomVal : Syntax → String → Syntax
  
goal: Lean.Syntax → String → Lean.Syntax

full_name: Lean.Syntax.ifNode
code: @[inline] def ifNode {β} (stx : Syntax) (hyes : SyntaxNode → β) (hno : Unit → β) : β 
goal: β

full_name: Lean.Syntax.ifNodeKind
code: @[inline] def ifNodeKind {β} (stx : Syntax) (kind : SyntaxNodeKind) (hyes : SyntaxNode → β) (hno : Unit → β) : β 
goal: β

full_name: Lean.Syntax.asNode
code: def asNode : Syntax → SyntaxNode
  
goal: Lean.Syntax → Lean.SyntaxNode

full_name: Lean.Syntax.getIdAt
code: def getIdAt (stx : Syntax) (i : Nat) : Name 
goal: Lean.Name

full_name: Lean.Syntax.modifyArgs
code: @[inline] def modifyArgs (stx : Syntax) (fn : Array Syntax → Array Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.modifyArg
code: @[inline] def modifyArg (stx : Syntax) (i : Nat) (fn : Syntax → Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.replaceM
code: @[specialize] partial def replaceM {m : Type → Type} [Monad m] (fn : Syntax → m (Option Syntax)) : Syntax → m (Syntax)
  
goal: Lean.Syntax → m Lean.Syntax

full_name: Lean.Syntax.rewriteBottomUpM
code: @[specialize] partial def rewriteBottomUpM {m : Type → Type} [Monad m] (fn : Syntax → m (Syntax)) : Syntax → m (Syntax)
  
goal: Lean.Syntax → m Lean.Syntax

full_name: Lean.Syntax.rewriteBottomUp
code: @[inline] def rewriteBottomUp (fn : Syntax → Syntax) (stx : Syntax) : Syntax 
goal: Lean.Syntax

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Syntax.0.Lean.Syntax.updateInfo
code: private def updateInfo : SourceInfo → String.Pos → String.Pos → SourceInfo
  
goal: Lean.SourceInfo → String.Pos → String.Pos → Lean.SourceInfo

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Syntax.0.Lean.Syntax.chooseNiceTrailStop
code: private def chooseNiceTrailStop (trail : Substring) : String.Pos 
goal: String.Pos

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Syntax.0.Lean.Syntax.updateLeadingAux
code: /-- Remark: the State `String.Pos` is the `SourceInfo.trailing.stopPos` of the previous token,
   or the beginning of the String. -/
@[inline]
private def updateLeadingAux : Syntax → StateM String.Pos (Option Syntax)
  
goal: Lean.Syntax → StateM String.Pos (Option Lean.Syntax)

full_name: Lean.Syntax.updateLeading
code: /-- Set `SourceInfo.leading` according to the trailing stop of the preceding token.
    The result is a round-tripping syntax tree IF, in the input syntax tree,
    * all leading stops, atom contents, and trailing starts are correct
    * trailing stops are between the trailing start and the next leading stop.

    Remark: after parsing, all `SourceInfo.leading` fields are empty.
    The `Syntax` argument is the output produced by the parser for `source`.
    This function "fixes" the `source.leading` field.

    Additionally, we try to choose "nicer" splits between leading and trailing stops
    according to some heuristics so that e.g. comments are associated to the (intuitively)
    correct token.

    Note that the `SourceInfo.trailing` fields must be correct.
    The implementation of this Function relies on this property. -/
def updateLeading : Syntax → Syntax 
goal: Lean.Syntax → Lean.Syntax

full_name: Lean.Syntax.updateTrailing
code: partial def updateTrailing (trailing : Substring) : Syntax → Syntax
  
goal: Lean.Syntax → Lean.Syntax

full_name: Lean.Syntax.identComponents
code: /-- Split an `ident` into its dot-separated components while preserving source info.
Macro scopes are first erased.  For example, `` `foo.bla.boo._@._hyg.4 `` ↦ `` [`foo, `bla, `boo] ``.
If `nFields` is set, we take that many fields from the end and keep the remaining components
as one name. For example, `` `foo.bla.boo `` with `(nFields := 1)` ↦ `` [`foo.bla, `boo] ``. -/
def identComponents (stx : Syntax) (nFields? : Option Nat := none) : List Syntax 
goal: List Lean.Syntax

full_name: Lean.Syntax.identComponents.nameComps
code: /-- Split an `ident` into its dot-separated components while preserving source info.
Macro scopes are first erased.  For example, `` `foo.bla.boo._@._hyg.4 `` ↦ `` [`foo, `bla, `boo] ``.
If `nFields` is set, we take that many fields from the end and keep the remaining components
as one name. For example, `` `foo.bla.boo `` with `(nFields := 1)` ↦ `` [`foo.bla, `boo] ``. -/
def identComponents (stx : Syntax) (nFields? : Option Nat := none) : List Syntax 
goal: List Lean.Name

full_name: Lean.Syntax.TopDown.stx
code: structure TopDown where
  firstChoiceOnly : Bool
  stx : Syntax
goal: Lean.Syntax

full_name: Lean.Syntax.TopDown.firstChoiceOnly
code: structure TopDown where
  firstChoiceOnly : Bool
  stx : Syntax
goal: Bool

full_name: Lean.Syntax.TopDown
code: structure TopDown where
  firstChoiceOnly : Bool
  stx : Syntax
goal: Type

full_name: Lean.Syntax.topDown
code: /--
`for _ in stx.topDown` iterates through each node and leaf in `stx` top-down, left-to-right.
If `firstChoiceOnly` is `true`, only visit the first argument of each choice node.
-/
def topDown (stx : Syntax) (firstChoiceOnly := false) : TopDown 
goal: Lean.Syntax.TopDown

full_name: Lean.Syntax.instForInTopDown.loop
code: partial instance : ForIn m TopDown Syntax 
goal: {β : Type u_1} →
  [inst : Monad m] →
    (Lean.Syntax → β → m (ForInStep β)) → Bool → Lean.Syntax → β → [inst : Inhabited β] → m (ForInStep β)

full_name: Lean.Syntax.instForInTopDown
code: partial instance : ForIn m TopDown Syntax 
goal: ForIn m Lean.Syntax.TopDown Lean.Syntax

full_name: Lean.Syntax.reprint
code: partial def reprint (stx : Syntax) : Option String 
goal: Option String

full_name: Lean.Syntax.reprint.reprintLeaf
code: partial def reprint (stx : Syntax) : Option String 
goal: String

full_name: Lean.Syntax.hasMissing
code: def hasMissing (stx : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.getRange?
code: def getRange? (stx : Syntax) (canonicalOnly := false) : Option String.Range 
goal: Option String.Range

full_name: Lean.Syntax.ofRange
code: /-- Returns a synthetic Syntax which has the specified `String.Range`. -/
def ofRange (range : String.Range) (canonical := true) : Lean.Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.Traverser.cur
code: /--
Represents a cursor into a syntax tree that can be read, written, and advanced down/up/left/right.
Indices are allowed to be out-of-bound, in which case `cur` is `Syntax.missing`.
If the `Traverser` is used linearly, updates are linear in the `Syntax` object as well.
-/
structure Traverser where
  cur     : Syntax
  parents : Array Syntax
  idxs    : Array Nat
goal: Lean.Syntax

full_name: Lean.Syntax.Traverser.parents
code: /--
Represents a cursor into a syntax tree that can be read, written, and advanced down/up/left/right.
Indices are allowed to be out-of-bound, in which case `cur` is `Syntax.missing`.
If the `Traverser` is used linearly, updates are linear in the `Syntax` object as well.
-/
structure Traverser where
  cur     : Syntax
  parents : Array Syntax
  idxs    : Array Nat
goal: Array Lean.Syntax

full_name: Lean.Syntax.Traverser.idxs
code: /--
Represents a cursor into a syntax tree that can be read, written, and advanced down/up/left/right.
Indices are allowed to be out-of-bound, in which case `cur` is `Syntax.missing`.
If the `Traverser` is used linearly, updates are linear in the `Syntax` object as well.
-/
structure Traverser where
  cur     : Syntax
  parents : Array Syntax
  idxs    : Array Nat
goal: Array Nat

full_name: Lean.Syntax.Traverser
code: /--
Represents a cursor into a syntax tree that can be read, written, and advanced down/up/left/right.
Indices are allowed to be out-of-bound, in which case `cur` is `Syntax.missing`.
If the `Traverser` is used linearly, updates are linear in the `Syntax` object as well.
-/
structure Traverser where
  cur     : Syntax
  parents : Array Syntax
  idxs    : Array Nat
goal: Type

full_name: Lean.Syntax.Traverser.fromSyntax
code: def fromSyntax (stx : Syntax) : Traverser 
goal: Lean.Syntax.Traverser

full_name: Lean.Syntax.Traverser.setCur
code: def setCur (t : Traverser) (stx : Syntax) : Traverser 
goal: Lean.Syntax.Traverser

full_name: Lean.Syntax.Traverser.down
code: /-- Advance to the `idx`-th child of the current node. -/
def down (t : Traverser) (idx : Nat) : Traverser 
goal: Lean.Syntax.Traverser

full_name: Lean.Syntax.Traverser.up
code: /-- Advance to the parent of the current node, if any. -/
def up (t : Traverser) : Traverser 
goal: Lean.Syntax.Traverser

full_name: Lean.Syntax.Traverser.left
code: /-- Advance to the left sibling of the current node, if any. -/
def left (t : Traverser) : Traverser 
goal: Lean.Syntax.Traverser

full_name: Lean.Syntax.Traverser.right
code: /-- Advance to the right sibling of the current node, if any. -/
def right (t : Traverser) : Traverser 
goal: Lean.Syntax.Traverser

full_name: Lean.Syntax.MonadTraverser
code: /-- Monad class that gives read/write access to a `Traverser`. -/
class MonadTraverser (m : Type → Type) where
  st : MonadState Traverser m
goal: Type 1

full_name: Lean.Syntax.MonadTraverser.st
code: /-- Monad class that gives read/write access to a `Traverser`. -/
class MonadTraverser (m : Type → Type) where
  st : MonadState Traverser m
goal: MonadState Lean.Syntax.Traverser m

full_name: Lean.Syntax.MonadTraverser.getCur
code: def getCur : m Syntax 
goal: m Lean.Syntax

full_name: Lean.Syntax.MonadTraverser.setCur
code: def setCur (stx : Syntax) : m Unit 
goal: m Unit

full_name: Lean.Syntax.MonadTraverser.goDown
code: def goDown (idx : Nat)    : m Unit 
goal: m Unit

full_name: Lean.Syntax.MonadTraverser.goUp
code: def goUp                  : m Unit 
goal: m Unit

full_name: Lean.Syntax.MonadTraverser.goLeft
code: def goLeft                : m Unit 
goal: m Unit

full_name: Lean.Syntax.MonadTraverser.goRight
code: def goRight               : m Unit 
goal: m Unit

full_name: Lean.Syntax.MonadTraverser.getIdx
code: def getIdx : m Nat 
goal: m Nat

full_name: Lean.SyntaxNode.getIdAt
code: @[inline] def getIdAt (n : SyntaxNode) (i : Nat) : Name 
goal: Lean.Name

full_name: Lean.mkListNode
code: def mkListNode (args : Array Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.isQuot
code: def isQuot : Syntax → Bool
  
goal: Lean.Syntax → Bool

full_name: Lean.Syntax.getQuotContent
code: def getQuotContent (stx : Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.isAntiquot
code: def isAntiquot : Syntax → Bool
  
goal: Lean.Syntax → Bool

full_name: Lean.Syntax.isAntiquots
code: def isAntiquots (stx : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.getCanonicalAntiquot
code: def getCanonicalAntiquot (stx : Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.mkAntiquotNode
code: def mkAntiquotNode (kind : Name) (term : Syntax) (nesting := 0) (name : Option String := none) (isPseudoKind := false) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.isEscapedAntiquot
code: def isEscapedAntiquot (stx : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.unescapeAntiquot
code: def unescapeAntiquot (stx : Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.getAntiquotTerm
code: def getAntiquotTerm (stx : Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.antiquotKind?
code: /-- Return kind of parser expected at this antiquotation, and whether it is a "pseudo" kind (see `mkAntiquot`). -/
def antiquotKind? : Syntax → Option (SyntaxNodeKind × Bool)
  
goal: Lean.Syntax → Option (Lean.SyntaxNodeKind × Bool)

full_name: Lean.Syntax.antiquotKinds
code: def antiquotKinds (stx : Syntax) : List (SyntaxNodeKind × Bool) 
goal: List (Lean.SyntaxNodeKind × Bool)

full_name: Lean.Syntax.antiquotSpliceKind?
code: def antiquotSpliceKind? : Syntax → Option SyntaxNodeKind
  
goal: Lean.Syntax → Option Lean.SyntaxNodeKind

full_name: Lean.Syntax.isAntiquotSplice
code: def isAntiquotSplice (stx : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.getAntiquotSpliceContents
code: def getAntiquotSpliceContents (stx : Syntax) : Array Syntax 
goal: Array Lean.Syntax

full_name: Lean.Syntax.getAntiquotSpliceSuffix
code: def getAntiquotSpliceSuffix (stx : Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.mkAntiquotSpliceNode
code: def mkAntiquotSpliceNode (kind : SyntaxNodeKind) (contents : Array Syntax) (suffix : String) (nesting := 0) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.antiquotSuffixSplice?
code: def antiquotSuffixSplice? : Syntax → Option SyntaxNodeKind
  
goal: Lean.Syntax → Option Lean.SyntaxNodeKind

full_name: Lean.Syntax.isAntiquotSuffixSplice
code: def isAntiquotSuffixSplice (stx : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.getAntiquotSuffixSpliceInner
code: def getAntiquotSuffixSpliceInner (stx : Syntax) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.mkAntiquotSuffixSpliceNode
code: def mkAntiquotSuffixSpliceNode (kind : SyntaxNodeKind) (inner : Syntax) (suffix : String) : Syntax 
goal: Lean.Syntax

full_name: Lean.Syntax.isTokenAntiquot
code: def isTokenAntiquot (stx : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.isAnyAntiquot
code: def isAnyAntiquot (stx : Syntax) : Bool 
goal: Bool

full_name: Lean.Syntax.Stack
code: /-- List of `Syntax` nodes in which each succeeding element is the parent of
the current. The associated index is the index of the preceding element in the
list of children of the current element. -/
protected abbrev Stack 
goal: Type

full_name: Lean.Syntax.findStack?.go
code: /-- Return stack of syntax nodes satisfying `visit`, starting with such a node that also fulfills `accept` (default "is leaf"), and ending with the root. -/
partial def findStack? (root : Syntax) (visit : Syntax → Bool) (accept : Syntax → Bool := fun stx => !stx.hasArgs) : Option Syntax.Stack 
goal: Option Lean.Syntax.Stack

full_name: Lean.Syntax.findStack?
code: /-- Return stack of syntax nodes satisfying `visit`, starting with such a node that also fulfills `accept` (default "is leaf"), and ending with the root. -/
partial def findStack? (root : Syntax) (visit : Syntax → Bool) (accept : Syntax → Bool := fun stx => !stx.hasArgs) : Option Syntax.Stack 
goal: Option Lean.Syntax.Stack

full_name: Lean.Syntax.Stack.matches
code: /-- Compare the `SyntaxNodeKind`s in `pattern` to those of the `Syntax`
elements in `stack`. Return `false` if `stack` is shorter than `pattern`. -/
def Stack.matches (stack : Syntax.Stack) (pattern : List $ Option SyntaxNodeKind) : Bool 
goal: Bool