diff options
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 |
