From 4119fa8c0c59bb39f9aeba7f479067fd834c4e20 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Fri, 3 Apr 2026 23:38:07 +0200 Subject: resolve types in protocols --- tools/Scanner.lean | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tools/Scanner.lean') diff --git a/tools/Scanner.lean b/tools/Scanner.lean index d6962c7..81b4181 100644 --- a/tools/Scanner.lean +++ b/tools/Scanner.lean @@ -1,22 +1,25 @@ import Scanner.Protocol import Scanner.Parser +import Scanner.Processor open WaylandScanner -def parseProtocol (path : System.FilePath) : IO ProtocolDesc := do +def parseRawProtocol (path : System.FilePath) : IO Raw.ProtocolDesc := do parse (← IO.FS.readFile path) |>.mapError (fun ε ↦ s!"{path}: {ε}") |> IO.ofExcept def process (rootModule : String) (outPath : System.FilePath) (srcPath : System.FilePath) : IO UInt32 := do - let protocols ← (← srcPath.readDir) + let rawProtocols ← (← srcPath.readDir) |>.map IO.FS.DirEntry.path - |>.mapM parseProtocol + |>.mapM parseRawProtocol + let clientProtocols ← processProtocols rawProtocols + |> IO.ofExcept let rootModuleComponents := rootModule.split "." |>.map String.Slice.toString |>.toArray let rootModulePath := rootModuleComponents.foldl (· / ·) outPath - IO.println (reprStr protocols) + IO.println (reprStr clientProtocols) IO.FS.createDirAll rootModulePath let indexPath := rootModulePath.addExtension "lean" IO.FS.writeFile indexPath "" -- cgit v1.3.1