chore: fix script/reformat.lean
This commit is contained in:
parent
c112ae7c58
commit
092e26179b
1 changed files with 3 additions and 3 deletions
|
|
@ -17,7 +17,7 @@ partial def reprintCore : Syntax → Option Format
|
||||||
| Syntax.missing => none
|
| Syntax.missing => none
|
||||||
| Syntax.atom _ val => val.trim
|
| Syntax.atom _ val => val.trim
|
||||||
| Syntax.ident _ rawVal _ _ => rawVal.toString
|
| Syntax.ident _ rawVal _ _ => rawVal.toString
|
||||||
| Syntax.node _ kind args =>
|
| Syntax.node _ _ args =>
|
||||||
match args.toList.filterMap reprintCore with
|
match args.toList.filterMap reprintCore with
|
||||||
| [] => none
|
| [] => none
|
||||||
| [arg] => arg
|
| [arg] => arg
|
||||||
|
|
@ -29,7 +29,7 @@ def reprint (stx : Syntax) : Format :=
|
||||||
def printCommands (cmds : Syntax) : CoreM Unit := do
|
def printCommands (cmds : Syntax) : CoreM Unit := do
|
||||||
for cmd in getCommands cmds |>.run #[] |>.2 do
|
for cmd in getCommands cmds |>.run #[] |>.2 do
|
||||||
try
|
try
|
||||||
IO.println (← ppCommand cmd).pretty
|
IO.println (← ppCommand ⟨cmd⟩).pretty
|
||||||
catch e =>
|
catch e =>
|
||||||
IO.println f!"/-\ncannot print: {← e.toMessageData.format}\n{reprint cmd}\n-/"
|
IO.println f!"/-\ncannot print: {← e.toMessageData.format}\n{reprint cmd}\n-/"
|
||||||
|
|
||||||
|
|
@ -70,4 +70,4 @@ unsafe def main (args : List String) : IO Unit := do
|
||||||
let mut first := true
|
let mut first := true
|
||||||
for {env, currNamespace, openDecls, ..} in moduleStx, stx in leadingUpdated do
|
for {env, currNamespace, openDecls, ..} in moduleStx, stx in leadingUpdated do
|
||||||
if first then first := false else IO.print "\n"
|
if first then first := false else IO.print "\n"
|
||||||
let _ ← printCommands stx |>.toIO {currNamespace, openDecls} {env}
|
let _ ← printCommands stx |>.toIO {fileName, fileMap := FileMap.ofString input, currNamespace, openDecls} {env}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue