diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2024-08-13 22:13:06 +0200 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2024-08-13 22:13:06 +0200 |
| commit | f4f93ad6e9289d499e1f4c6cf7f9581e622f2d26 (patch) | |
| tree | cfbcbcec58a9ac8a422e4084051c41b64bbc5fda /protocols/codegen/Wayland/CodeGen/Parser.hs | |
| parent | 68aa2b10c8ad9782a61a6699262751ec5cb93709 (diff) | |
impl codegen
Diffstat (limited to 'protocols/codegen/Wayland/CodeGen/Parser.hs')
| -rw-r--r-- | protocols/codegen/Wayland/CodeGen/Parser.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/protocols/codegen/Wayland/CodeGen/Parser.hs b/protocols/codegen/Wayland/CodeGen/Parser.hs index e2f6c23..15afbb9 100644 --- a/protocols/codegen/Wayland/CodeGen/Parser.hs +++ b/protocols/codegen/Wayland/CodeGen/Parser.hs @@ -37,8 +37,8 @@ processInterface el = do version <- requireAttr "version" el >>= readEither description <- mapM processDescription (filterChildName (matchName "description") el) enums <- mapM processEnum (filterChildrenName (matchName "enum") el) - requests <- mapM processMessage (filterChildrenName (matchName "request") el) - events <- mapM processMessage (filterChildrenName (matchName "event") el) + requests <- mapM processMessage (zip (filterChildrenName (matchName "request") el) [0..]) + events <- mapM processMessage (zip (filterChildrenName (matchName "event" ) el) [0..]) pure $ InterfaceDesc { ifName = name , ifVersion = version , ifDescription = description @@ -77,8 +77,8 @@ processEntry el = do , entryDeprecatedSince = deprecatedSince } -processMessage :: Element -> Either String MessageDesc -processMessage el = do +processMessage :: (Element, Int) -> Either String MessageDesc +processMessage (el, opcode) = do name <- requireAttr "name" el description <- mapM processDescription (filterChildName (matchName "description") el) type' <- mapM readMessageType (findAttrBy (matchName "type") el) @@ -86,6 +86,7 @@ processMessage el = do deprecatedSince <- mapM readEither (findAttrBy (matchName "deprecated-since") el) arguments <- mapM processArgument (filterChildrenName (matchName "arg") el) pure $ MessageDesc { msgName = name + , msgOpCode = opcode , msgDescription = description , msgType = fromMaybe MessageNormal type' , msgSince = fromMaybe 1 since |
