packages feed

uu-parsinglib 2.3.1 → 2.3.3

raw patch · 6 files changed

+79/−25 lines, 6 filesdep ~basesetup-changed

Dependency ranges changed: base

Files

LICENSE view
@@ -1,5 +1,22 @@-HNOP is written by Ashley Yakeley.+Copyright (c) 2010, SD Swierstra+All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining this work (the "Work"), to deal in the Work without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Work, and to permit persons to whom the Work is furnished to do so.+The MIT License -THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS IN THE WORK. +Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.
Setup.hs view
@@ -1,3 +1,4 @@ #!/usr/bin/env runhaskell import Distribution.Simple-main = defaultMainWithHooks simpleUserHooks+main :: IO ()+main = defaultMain
src/Text/ParserCombinators/UU/BasicInstances.hs view
@@ -61,3 +61,17 @@  instance  Stores (Str a) [Error a a Int] where        getErrors   (Str  inp      msgs pos ok    )        = (msgs, Str inp [] pos ok)++-- tempory addition of pMunch++instance (Show a) => Provides (Str a) (Munch a) [a] where +       splitState (Munch p) k (Str tts msgs pos del_ok)+          =    let (munched, rest) = span p tts+                   l               = length munched+               in Step l (k munched (Str rest msgs (pos+l)  (l>0 || del_ok)))++data Munch a = Munch (a -> Bool)++pMunch :: (Text.ParserCombinators.UU.Core.Symbol p (Munch a) [a]) => (a -> Bool) -> p [a]+pMunch p = pSym (Munch p) +
src/Text/ParserCombinators/UU/Core.hs view
@@ -21,10 +21,6 @@ import Debug.Trace import Maybe -{--infixl  4  <*, *>-infixl  4  <$--} -- * The Classes Defining the Interface -- ** `IsParser` @@ -37,6 +33,7 @@  infixl  4  <*, *> infixl  4  <$+infix   2  <?>  -- ** `ExtApplicative' -- | The module "Control.Applicative" contains definitions for `<$`, `*>`  and `<*` which cannot be changed. Since we want to give@@ -195,16 +192,24 @@                                            , \  k inp  -> pr k inp `best` qr k inp                                            )    empty                =  P  ( \  k inp  ->  noAlts-                             , \ k inp  -> noAlts-                             , \  k inp  -> noAlts+                             , \  k inp  ->  noAlts+                             , \  k inp  ->  noAlts                              )   instance  ( Provides state symbol token) => Symbol (P  state) symbol token where   pSym a =  P ( \ k inp -> splitState a k inp               , \ k inp -> splitState a (\ t inp' -> push t (k inp')) inp-              , \ k inp -> splitState a (\ v inp' -> k inp') inp+              , \ k inp -> splitState a (\ _ inp' -> k inp') inp               ) +(<?>) :: P state a -> String -> P state a+P (ph, pf, pr) <?> label = P ( \ k inp -> replaceExpected  ( ph k inp)+                             , \ k inp -> replaceExpected  ( pf k inp)+                             , \ k inp -> replaceExpected  ( pr k inp)+                             )+                           where replaceExpected (Fail _ c) = (Fail [label] c)+                                 replaceExpected others     = others+       data Id a = Id a deriving Show  -- parse_h (P (ph, pf, pr)) = fst . eval . ph  (\ a rest -> if eof rest then push a failAlways else error "pEnd missing?") 
src/Text/ParserCombinators/UU/Examples.hs view
@@ -44,9 +44,11 @@           print (test paz "ab1z7")           print (test paz' "m")           print (test paz' "")+          print (test (pa <|> pb <?> "just a message") "c")           print (test parseBoth "(123;456;789)")-+          print (test munch "a^^&&**^^&b") +munch = (,,) <$> pa <*> pMunch ( `elem` "^&*") <*> pb  -- bracketing expressions pParens p =  pSym '(' *> p <* pSym ')'
uu-parsinglib.cabal view
@@ -1,7 +1,7 @@ Name:                uu-parsinglib-Version:             2.3.1+Version:             2.3.3 Build-Type:          Simple-License:             LGPL+License:             MIT  License-file:        LICENSE Author:              Doaitse Swierstra Maintainer:          doaitse@swierstra.net       @@ -9,7 +9,7 @@ Homepage:            http://www.cs.uu.nl/wiki/bin/view/HUT/ParserCombinators Bug-reports:         mailto:doaitse@swierstra.net Synopsis:            New version of the Utrecht University parser combinator library        -Cabal-Version:       >=1.2+Cabal-Version:       >=1.4 Description:         New version of the Utrecht University parser combinator library, providing online, error correction,                       annotation free, applicative style parser combinators which also provides a monadic interface                      .@@ -24,25 +24,40 @@                      .                      Versions above 2.2:                      .-                     *  make use of type families-                     .   +                     *  make use of type families                         *  contain a module with many list-based derived combinators                      .-                     Versions above 2.3-                     . contain some form of abstract interpretation from the old uulib versions of these combinators-                     . are closer to Haskell98, since they do not make use of type families anymore-                     . note that the basic parser interface will probably not change when we add more features, but the calling conventions+                     Version 2.3.1+                     .+                     * fix for GHC 6.12, because of change in GADT definition handling+                     .+                     Version 2.3.2+                     .+		     * added microsteps, which can be used to disambiguate+                     .+                     Version 2.3.3+                     .+                     * added pMunch which takes a Boolean function, and recognises the longest prefix for which the symbols match the predicate +                     .+                     * added the infix operator with piority 2 <?> :: P state a -> String -> P st a which replaces the list of expected symbols+                       in error message by its right argument String+                     .+                     Future versions above 2.3+                     .+                     * contain some form of abstract interpretation from the old uulib versions of these combinators+                     .+                     * are closer to Haskell98, since they do not make use of type families anymore+                     .+                     * note that the basic parser interface will probably not change much when we add more features, but the calling conventions                        of the outer parser and the class structure upon which the parametrisation is based may change                      . -                     Version 2.3.1-                     . fix for GHC 6.12, because of change in GADT definition handling                      -Category:            Text.ParserCombinators Parsing Text+Category:            ParserCombinators Parsing Text  Library   hs-source-dirs:    src -  Build-Depends:     base > 2 && <= 4, haskell98+  Build-Depends:     base >= 4 && <5, haskell98   Exposed-modules:   Text.ParserCombinators.UU.Parsing                       Text.ParserCombinators.UU.Core                        Text.ParserCombinators.UU.BasicInstances