You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: remove unused parser state in example's environment extension
Only `Command.State` is needed to thread several example blocks.
Note that before we used the parsing state resulting from the last
code block, so we did resume from an offset that could be potentially
much before the current code block.
This worked as the string in that case was empty (produced by
`parserInputString`), but would have failed once we have reuse of the
input source string.
if header.raw[1].isNone then-- if the "prelude" option was not set, use the current env
471
471
let commandState := configureCommandState (← getEnv) {}
472
472
let commandState := { commandState with scopes := [{ header := "", opts := pp.tagAppFns.set {} true }] }
473
-
modifyEnv <| fun env => exampleContextExt.modifyState env fun s => {s with contexts := s.contexts.insert config.exampleContext.getId (.inline commandState state)}
473
+
modifyEnv <| fun env => exampleContextExt.modifyState env fun s => {s with contexts := s.contexts.insert config.exampleContext.getId (.inline commandState)}
474
474
else
475
475
if header.raw[2].getArgs.isEmpty then
476
476
let (env, msgs) ← processHeader header opts msgs context 0
let commandState := { commandState with scopes := [{ header := "", opts := pp.tagAppFns.set {} true }] }
483
-
modifyEnv <| fun env => exampleContextExt.modifyState env fun s => {s with contexts := s.contexts.insert config.exampleContext.getId (.inline commandState state)}
483
+
modifyEnv <| fun env => exampleContextExt.modifyState env fun s => {s with contexts := s.contexts.insert config.exampleContext.getId (.inline commandState)}
484
484
if config.show then
485
485
``(Block.code $(quote str.getString)) -- TODO highlighting hack
486
486
else
@@ -494,8 +494,8 @@ open SubVerso.Highlighting Highlighted in
494
494
deflean : CodeBlockExpanderOf LeanBlockConfig
495
495
| config, str => withTraceNode `Elab.Verso.block.lean (fun _ => pure m!"lean block") <| withoutAsync do
496
496
let x := config.exampleContext
497
-
let(commandState, _state) ← match exampleContextExt.getState (← getEnv) |>.contexts.find? x.getId with
498
-
| some (.inline commandState state) => pure (commandState, state)
497
+
let commandState ← match exampleContextExt.getState (← getEnv) |>.contexts.find? x.getId with
498
+
| some (.inline commandState) => pure (commandState)
499
499
| some (.subproject ..) => throwErrorAt x "Expected an example context for inline Lean, but found a subproject"
500
500
| some (.module ..) => throwErrorAt x "Expected an example context for inline Lean, but found a module"
501
501
| none => throwErrorAt x "Can't find example context"
0 commit comments