diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2026-04-03 23:38:07 +0200 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2026-04-03 23:38:07 +0200 |
| commit | 4119fa8c0c59bb39f9aeba7f479067fd834c4e20 (patch) | |
| tree | d949428ac1697b6cb28dcdf2a628984200d9a7c2 /tools/Scanner.lean | |
| parent | 09be9fb2701f0560aeb714f89fe0d1e750915ae0 (diff) | |
resolve types in protocols
Diffstat (limited to 'tools/Scanner.lean')
| -rw-r--r-- | tools/Scanner.lean | 11 |
1 files changed, 7 insertions, 4 deletions
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 "" |
