@@ -56,20 +56,26 @@ def SorryData.toParsedSorry {Out} [ToString Out] (fileMap : FileMap) : SorryData
5656instance : ToString ParsedSorry where
5757 toString a := ToString.toString <| ToJson.toJson a
5858
59+ #check Frontend.State
5960
6061/-- `extractInfoTree myLeanFile` takes as input the path to a Lean file and outputs
6162the infotrees of the file, together with the `FileMap`. -/
62- def extractInfoTrees (fileName : System.FilePath) : IO ( FileMap × List InfoTree) := do
63+ def extractInfoTrees (fileName : System.FilePath) : IO (FileMap × List InfoTree) := do
6364 let input ← IO.FS.readFile fileName
6465 let inputCtx := Parser.mkInputContext input fileName.toString
6566 let (header, parserState, messages) ← Parser.parseHeader inputCtx
67+ if Lean.MessageLog.hasErrors messages then
68+ IO.println s! "Ran into errors while parsing the header of { fileName} "
6669 -- TODO: do we need to specify the main module here?
6770 let (env, messages) ← processHeader header {} messages inputCtx
71+ if Lean.MessageLog.hasErrors messages then
72+ IO.println s! "Ran into errors whist processing the header of { fileName} "
6873 let commandState := Command.mkState env messages
69- let s ← IO.processCommands inputCtx parserState commandState
74+ let frontendState ← IO.processCommands inputCtx parserState commandState
75+ if Lean.MessageLog.hasErrors frontendState.commandState.messages then
76+ IO.println s! "Ran into errors whist processing the commands in { fileName} "
7077 let fileMap := FileMap.ofString input
71- return (fileMap, s.commandState.infoState.trees.toList)
72-
78+ return (fileMap, frontendState.commandState.infoState.trees.toList)
7379
7480/-
7581Note: we may want to implememt the following functions in Python in order to
0 commit comments