Documentation

Lean.Parser.Basic

@[inline]
Equations
@[inline]
abbrev Lean.Parser.mkIdent (info : Lean.SourceInfo) (rawVal : Substring) (val : Lean.Name) :
Equations
def Lean.Parser.getNext (input : String) (pos : Nat) :
Equations
@[inline]
abbrev Lean.Parser.Token :
Type
Equations
structure Lean.Parser.TokenCacheEntry :
Type
Equations
structure Lean.Parser.InputContext :
Type
Equations
Equations
structure Lean.Parser.Error :
Type
Equations
Equations
Equations
  • Lean.Parser.Error.merge e₁ e₂ = match e₂ with | { unexpected := u, expected := x } => { unexpected := if (u == "") = true then e₁.unexpected else u, expected := e₁.expected ++ e₂.expected }
structure Lean.Parser.ParserState :
Type
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
  • Lean.Parser.ParserState.setError s msg = match s with | { stxStack := stack, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := x } => { stxStack := stack, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some { unexpected := "", expected := [msg] } }
Equations
Equations
Equations
  • Lean.Parser.ParserState.mkErrorAt s msg pos initStackSz? = match s, initStackSz? with | { stxStack := stack, lhsPrec := lhsPrec, pos := x, cache := cache, errorMsg := x_1 }, none => { stxStack := Array.push stack Lean.Syntax.missing, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some { unexpected := "", expected := [msg] } } | { stxStack := stack, lhsPrec := lhsPrec, pos := x, cache := cache, errorMsg := x_1 }, some sz => { stxStack := Array.push (Array.shrink stack sz) Lean.Syntax.missing, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some { unexpected := "", expected := [msg] } }
Equations
  • Lean.Parser.ParserState.mkErrorsAt s ex pos initStackSz? = match s, initStackSz? with | { stxStack := stack, lhsPrec := lhsPrec, pos := x, cache := cache, errorMsg := x_1 }, none => { stxStack := Array.push stack Lean.Syntax.missing, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some { unexpected := "", expected := ex } } | { stxStack := stack, lhsPrec := lhsPrec, pos := x, cache := cache, errorMsg := x_1 }, some sz => { stxStack := Array.push (Array.shrink stack sz) Lean.Syntax.missing, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some { unexpected := "", expected := ex } }
Equations
Equations
Equations
Equations
Equations
Equations
@[noinline]
Equations
@[noinline]
Equations
@[noinline]
Equations
Equations
  • Lean.Parser.errorAtSavedPosFn msg delta c s = match c.savedPos? with | none => s | some pos => let pos := if delta = true then String.next c.toInputContext.input pos else pos; match s with | { stxStack := stack, lhsPrec := lhsPrec, pos := x, cache := cache, errorMsg := x_1 } => { stxStack := Array.push stack Lean.Syntax.missing, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some { unexpected := msg, expected := [] } }
@[inline]
Equations
Equations
Equations
Equations
Equations
Equations
Equations
  • Lean.Parser.addQuotDepthFn i p c s = p { toInputContext := c.toInputContext, toParserModuleContext := c.toParserModuleContext, prec := c.prec, tokens := c.tokens, quotDepth := Int.toNat (Int.ofNat c.quotDepth + i), suppressInsideQuot := c.suppressInsideQuot, savedPos? := c.savedPos?, forbiddenTk? := c.forbiddenTk? } s
Equations
  • Lean.Parser.suppressInsideQuotFn p c s = p { toInputContext := c.toInputContext, toParserModuleContext := c.toParserModuleContext, prec := c.prec, tokens := c.tokens, quotDepth := c.quotDepth, suppressInsideQuot := true, savedPos? := c.savedPos?, forbiddenTk? := c.forbiddenTk? } s
Equations
  • Lean.Parser.mergeOrElseErrors s error1 iniPos mergeErrors = match s with | { stxStack := stack, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some error2 } => if (pos == iniPos) = true then { stxStack := stack, lhsPrec := lhsPrec, pos := pos, cache := cache, errorMsg := some (if mergeErrors = true then Lean.Parser.Error.merge error1 error2 else error2) } else s | other => other
Equations
@[noinline]
Equations
@[inline]
Equations
@[noinline]
Equations
Equations
  • Lean.Parser.atomicFn p c s = let iniPos := s.pos; match p c s with | { stxStack := stack, lhsPrec := lhsPrec, pos := x, cache := cache, errorMsg := some msg } => { stxStack := stack, lhsPrec := lhsPrec, pos := iniPos, cache := cache, errorMsg := some msg } | other => other
@[inline]
Equations
Equations
@[noinline]
Equations
@[inline]
Equations
@[inline]
Equations
Equations
Equations
@[noinline]
Equations
@[noinline]
Equations
  • Lean.Parser.sepBy1Info p sep = { collectTokens := p.collectTokens sep.collectTokens, collectKinds := p.collectKinds sep.collectKinds, firstTokens := p.firstTokens }
@[inline]
Equations
@[inline]
Equations
@[noinline]
Equations
def Lean.Parser.satisfyFn (p : CharBool) (errorMsg : optParam String "unexpected character") :
Equations
Equations
@[inline]
Equations
@[inline]
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
@[inline]
Equations
Equations
Equations
Equations
Equations
Equations
@[inline]
Equations
def Lean.Parser.strAux (sym : String) (errorMsg : String) (j : Nat) :
Equations
Equations
Equations
Equations
Equations
Equations
@[inline]
Equations
@[inline]
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Equations
@[inline]
Equations
Equations
Equations
Equations
Equations
  • Lean.Parser.ParserState.keepPrevError s oldStackSize oldStopPos oldError = match s with | { stxStack := stack, lhsPrec := lhsPrec, pos := x, cache := cache, errorMsg := x_1 } => { stxStack := Array.shrink stack oldStackSize, lhsPrec := lhsPrec, pos := oldStopPos, cache := cache, errorMsg := oldError }
Equations
Equations
Equations
def Lean.Parser.longestMatchStep (left? : Option Lean.Syntax) (startSize : Nat) (startLhsPrec : Nat) (startPos : String.Pos) (prevPrio : Nat) (prio : Nat) (p : Lean.Parser.ParserFn) :
Equations
def Lean.Parser.longestMatchFnAux (left? : Option Lean.Syntax) (startSize : Nat) (startLhsPrec : Nat) (startPos : String.Pos) (prevPrio : Nat) (ps : List (Lean.Parser.Parser × Nat)) :
Equations
def Lean.Parser.longestMatchFnAux.parse (left? : Option Lean.Syntax) (startSize : Nat) (startLhsPrec : Nat) (startPos : String.Pos) (prevPrio : Nat) (ps : List (Lean.Parser.Parser × Nat)) :
Equations
Equations
@[inline]
Equations
@[inline]
def Lean.Parser.checkColGe (errorMsg : optParam String "checkColGe") :
Equations
@[inline]
Equations
@[inline]
def Lean.Parser.checkColGt (errorMsg : optParam String "checkColGt") :
Equations
@[inline]
Equations
@[inline]
def Lean.Parser.checkLineEq (errorMsg : optParam String "checkLineEq") :
Equations
@[inline]
Equations
  • Lean.Parser.withPosition p = { info := p.info, fn := fun c s => Lean.Parser.Parser.fn p { toInputContext := c.toInputContext, toParserModuleContext := c.toParserModuleContext, prec := c.prec, tokens := c.tokens, quotDepth := c.quotDepth, suppressInsideQuot := c.suppressInsideQuot, savedPos? := some s.pos, forbiddenTk? := c.forbiddenTk? } s }
@[inline]
Equations
  • Lean.Parser.withoutPosition p = { info := p.info, fn := fun c s => let pos := Lean.FileMap.toPosition c.toInputContext.fileMap s.pos; Lean.Parser.Parser.fn p { toInputContext := c.toInputContext, toParserModuleContext := c.toParserModuleContext, prec := c.prec, tokens := c.tokens, quotDepth := c.quotDepth, suppressInsideQuot := c.suppressInsideQuot, savedPos? := none, forbiddenTk? := c.forbiddenTk? } s }
@[inline]
Equations
  • Lean.Parser.withForbidden tk p = { info := p.info, fn := fun c s => Lean.Parser.Parser.fn p { toInputContext := c.toInputContext, toParserModuleContext := c.toParserModuleContext, prec := c.prec, tokens := c.tokens, quotDepth := c.quotDepth, suppressInsideQuot := c.suppressInsideQuot, savedPos? := c.savedPos?, forbiddenTk? := some tk } s }
@[inline]
Equations
  • Lean.Parser.withoutForbidden p = { info := p.info, fn := fun c s => Lean.Parser.Parser.fn p { toInputContext := c.toInputContext, toParserModuleContext := c.toParserModuleContext, prec := c.prec, tokens := c.tokens, quotDepth := c.quotDepth, suppressInsideQuot := c.suppressInsideQuot, savedPos? := c.savedPos?, forbiddenTk? := none } s }
Equations
@[inline]
Equations
noncomputable def Lean.Parser.TokenMap (α : Type) :
Type
Equations
def Lean.Parser.TokenMap.insert {α : Type} (map : Lean.Parser.TokenMap α) (k : Lean.Name) (v : α) :
Equations
Equations
  • Lean.Parser.TokenMap.instInhabitedTokenMap = { default := Std.RBMap.empty }
Equations
  • Lean.Parser.TokenMap.instEmptyCollectionTokenMap = { emptyCollection := Std.RBMap.empty }
Equations
Equations
Equations
Equations
  • Lean.Parser.categoryParser catName prec = { info := { collectTokens := id, collectKinds := id, firstTokens := Lean.Parser.FirstTokens.unknown }, fn := fun c s => Lean.Parser.categoryParserFn catName { toInputContext := c.toInputContext, toParserModuleContext := c.toParserModuleContext, prec := prec, tokens := c.tokens, quotDepth := c.quotDepth, suppressInsideQuot := c.suppressInsideQuot, savedPos? := c.savedPos?, forbiddenTk? := c.forbiddenTk? } s }
Equations
Equations
  • Lean.Parser.setExpectedFn expected p c s = match p c s with | s'@h:{ stxStack := x, lhsPrec := x_1, pos := x_2, cache := x_3, errorMsg := some msg } => { stxStack := s'.stxStack, lhsPrec := s'.lhsPrec, pos := s'.pos, cache := s'.cache, errorMsg := some { unexpected := msg.unexpected, expected := [] } } | s' => s'
Equations
Equations
@[inline]
Equations
Equations
@[inline]
Equations
@[inline]
Equations
Equations
@[inline]
Equations
Equations
Equations
Equations
Equations
Equations
@[inline]
Equations
@[inline]
Equations
Equations
@[inline]
Equations
@[inline]
def Lean.Syntax.foldArgsM {β : Type} {m : TypeType} [inst : Monad m] (s : Lean.Syntax) (f : Lean.Syntaxβm β) (b : β) :
m β
Equations
@[inline]
def Lean.Syntax.foldArgs {β : Type} (s : Lean.Syntax) (f : Lean.Syntaxββ) (b : β) :
β
Equations
@[inline]
def Lean.Syntax.forArgsM {m : TypeType} [inst : Monad m] (s : Lean.Syntax) (f : Lean.Syntaxm Unit) :
Equations