chore: modulize: work around unknown initial command (#12080)
This commit is contained in:
parent
34d8eeb3be
commit
16873fb123
1 changed files with 3 additions and 3 deletions
|
|
@ -38,11 +38,11 @@ def main (args : List String) : IO Unit := do
|
||||||
let startPos := header.raw.getPos? |>.getD parserState.pos
|
let startPos := header.raw.getPos? |>.getD parserState.pos
|
||||||
|
|
||||||
let dummyEnv ← mkEmptyEnvironment
|
let dummyEnv ← mkEmptyEnvironment
|
||||||
let (initCmd, parserState', _) :=
|
let (initCmd, parserState', msgs') :=
|
||||||
Parser.parseCommand inputCtx { env := dummyEnv, options := {} } parserState msgs
|
Parser.parseCommand inputCtx { env := dummyEnv, options := {} } parserState msgs
|
||||||
|
|
||||||
-- insert section if any trailing command
|
-- insert section if any trailing command (or error, which could be from an unknown command)
|
||||||
if !initCmd.isOfKind ``Parser.Command.eoi then
|
if !initCmd.isOfKind ``Parser.Command.eoi || msgs'.hasErrors then
|
||||||
let insertPos? :=
|
let insertPos? :=
|
||||||
-- put below initial module docstring if any
|
-- put below initial module docstring if any
|
||||||
guard (initCmd.isOfKind ``Parser.Command.moduleDoc) *> initCmd.getTailPos? <|>
|
guard (initCmd.isOfKind ``Parser.Command.moduleDoc) *> initCmd.getTailPos? <|>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue