packages feed

language-webidl 0.1.3.1 → 0.1.4.0

raw patch · 5 files changed

+21/−5 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.WebIDL.AST: Callback :: a -> Ident -> ReturnType -> [Argument a] -> Callback a
+ Language.WebIDL.AST: DefCallback :: (Callback a) -> Definition a
+ Language.WebIDL.AST: data Callback a
+ Language.WebIDL.AST: instance GHC.Base.Functor Language.WebIDL.AST.Callback
+ Language.WebIDL.AST: instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.WebIDL.AST.Callback a)
+ Language.WebIDL.AST: instance GHC.Show.Show a => GHC.Show.Show (Language.WebIDL.AST.Callback a)
+ Language.WebIDL.PPrint: instance Text.PrettyPrint.Leijen.Pretty (Language.WebIDL.AST.Callback a)

Files

language-webidl.cabal view
@@ -1,10 +1,9 @@ name:               language-webidl-version:            0.1.3.1+version:            0.1.4.0 synopsis:           Parser and Pretty Printer for WebIDL description:-    It is intended to replace the old package-    <https://hackage.haskell.org/package/webidl>.-    This new package is written with parsec and wl-pprint.+    Written with parsec and wl-pprint.+    See <http://www.w3.org/TR/WebIDL/> for reference. license:             MIT license-file:        LICENSE author:              Zhen Zhang <izgzhen@gmail.com>
src/Language/WebIDL/AST.hs view
@@ -16,6 +16,7 @@                   | DefException (Exception a)                   | DefEnum (Enum a)                   | DefTypedef (Typedef a)+                  | DefCallback (Callback a)                   | DefImplementsStatement (ImplementsStatement a)                   deriving (Show, Eq, Functor) @@ -35,6 +36,9 @@ data Partial a = PartialInterface a Ident [InterfaceMember a]                | PartialDictionary a Ident [DictionaryMember a]                deriving (Show, Eq, Functor)++-- | Callback functions+data Callback a = Callback a Ident ReturnType [Argument a] deriving (Show, Eq, Functor)  -- | @dictionary@ data Dictionary a = Dictionary a Ident (Maybe Ident) [DictionaryMember a] deriving (Show, Eq, Functor)
src/Language/WebIDL/PPrint.hs view
@@ -23,10 +23,15 @@     pretty (DefEnum x) = pretty x     pretty (DefTypedef x) = pretty x     pretty (DefImplementsStatement x) = pretty x+    pretty (DefCallback x) = pretty x  instance Pretty (Interface a) where     pretty (Interface _ extAttrs x mInherit members) =         prettyExtAttrs extAttrs line <> text "interface" <+> pretty x <+> prettyInherit mInherit <+> scope members <> semi++instance Pretty (Callback a) where+    pretty (Callback _ f retty args) = text "callback" <+> pretty f <+>+                                       equals <+> pretty retty <+> prettyParenList args  prettyExtAttrs :: [ExtendedAttribute a] -> Doc -> Doc prettyExtAttrs [] _ = empty
src/Language/WebIDL/Parser.hs view
@@ -50,12 +50,19 @@  pDef :: MyParser (Definition Tag) pDef = try (DefInterface <$> pInterface)+   <|> DefCallback <$> pCallback    <|> DefPartial <$> pPartial    <|> DefDictionary <$> pDictionary    <|> DefException <$> pException    <|> DefEnum <$> pEnum    <|> DefTypedef <$> pTypedef    <|> DefImplementsStatement <$> pImplementsStatement++pCallback :: MyParser (Callback Tag)+pCallback = Callback <$> (string "callback" *> pSpaces *> getTag)+                     <*> pIdent+                     <*> (pEq *> pReturnType <* pSpaces)+                     <*> pParenComma pArg  pExtAttrs :: MyParser [ExtendedAttribute Tag] pExtAttrs = try (brackets (pSpaces *> sepBy (pExtAttr <* pSpaces) (char ',' <* pSpaces)))
test/Test.hs view
@@ -8,7 +8,8 @@  tests :: Test tests = TestList [ TestLabel "WebGL" (testIDL "examples/webgl.idl")-                 , TestLabel "File API" (testIDL "examples/fileapi.idl") ]+                 , TestLabel "File API" (testIDL "examples/fileapi.idl")+                 , TestLabel "Callback" (testIDL "examples/callback.idl") ]  testIDL :: FilePath -> Test testIDL idlpath = TestCase $ do