packages feed

parsers 0.12.8 → 0.12.9

raw patch · 7 files changed

+201/−85 lines, 7 filesdep +binarydep ~containers

Dependencies added: binary

Dependency ranges changed: containers

Files

.travis.yml view
@@ -1,108 +1,163 @@-# This file has been generated -- see https://github.com/hvr/multi-ghc-travis+# This Travis job script has been generated by a script via+#+#   runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-unconstrained' 'cabal.project' '--hlint' '--hlint-options=--cpp-define=HLINT' '--allow-failure=7.0.4' '--allow-failure=7.2.2'+#+# For more information, see https://github.com/hvr/multi-ghc-travis+# language: c sudo: false +git:+  submodules: false  # whether to recursively clone submodules++notifications:+  irc:+    channels:+      - "irc.freenode.org#haskell-lens"+    skip_join: true+    template:+      - "\x0313parsers\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"+ cache:   directories:-    - $HOME/.cabsnap     - $HOME/.cabal/packages+    - $HOME/.cabal/store  before_cache:   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log-  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar+  # remove files that are regenerated by 'cabal update'+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx +  - rm -rfv $HOME/.cabal/packages/head.hackage+ matrix:   include:-    - env: CABALVER=1.24 GHCVER=7.0.4-      compiler: ": #GHC 7.0.4"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.0.4,hlint], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.2.2-      compiler: ": #GHC 7.2.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.2.2,hlint], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.4.2-      compiler: ": #GHC 7.4.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.4.2,hlint], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.6.3-      compiler: ": #GHC 7.6.3"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3,hlint], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.8.4-      compiler: ": #GHC 7.8.4"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4,hlint], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.10.3-      compiler: ": #GHC 7.10.3"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3,hlint], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=8.0.2-      compiler: ": #GHC 8.0.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,hlint], sources: [hvr-ghc]}}-    - env: CABALVER=2.0 GHCVER=8.2.2-      compiler: ": #GHC 8.2.2"-      addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,hlint], sources: [hvr-ghc]}}+    - compiler: "ghc-8.6.1"+      env: GHCHEAD=true+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}+    - compiler: "ghc-8.4.3"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}+    - compiler: "ghc-8.2.2"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}+    - compiler: "ghc-8.0.2"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}+    - compiler: "ghc-7.10.3"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}}+    - compiler: "ghc-7.8.4"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}+    - compiler: "ghc-7.6.3"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}+    - compiler: "ghc-7.4.2"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}}+    - compiler: "ghc-7.2.2"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.2.2], sources: [hvr-ghc]}}+    - compiler: "ghc-7.0.4"+    # env: TEST=--disable-tests BENCH=--disable-benchmarks+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}}+    - compiler: "ghc-head"+      env: GHCHEAD=true+      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}} +  allow_failures:+    - compiler: "ghc-head"+    - compiler: "ghc-7.0.4"+    - compiler: "ghc-7.2.2"+    - compiler: "ghc-8.6.1"+ before_install:- - unset CC- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH+  - HC=${CC}+  - HCPKG=${HC/ghc/ghc-pkg}+  - unset CC+  - ROOTDIR=$(pwd)+  - mkdir -p $HOME/.local/bin+  - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"+  - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))+  - echo $HCNUMVER  install:- - cabal --version- - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"- - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];-   then-     zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >-          $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;-   fi- - travis_retry cabal update -v- - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config- - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt- - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt+  - cabal --version+  - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"+  - BENCH=${BENCH---enable-benchmarks}+  - TEST=${TEST---enable-tests}+  - HADDOCK=${HADDOCK-true}+  - UNCONSTRAINED=${UNCONSTRAINED-true}+  - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}+  - GHCHEAD=${GHCHEAD-false}+  - travis_retry cabal update -v+  - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"+  - rm -fv cabal.project cabal.project.local+  # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage+  - |+    if $GHCHEAD; then+      sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config+      for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done -# check whether current requested install-plan matches cached package-db snapshot- - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;-   then-     echo "cabal build-cache HIT";-     rm -rfv .ghc;-     cp -a $HOME/.cabsnap/ghc $HOME/.ghc;-     cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;-   else-     echo "cabal build-cache MISS";-     rm -rf $HOME/.cabsnap;-     mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;-     cabal install -j --only-dependencies --enable-tests --enable-benchmarks;-   fi+      echo 'repository head.hackage'                                                        >> ${HOME}/.cabal/config+      echo '   url: http://head.hackage.haskell.org/'                                       >> ${HOME}/.cabal/config+      echo '   secure: True'                                                                >> ${HOME}/.cabal/config+      echo '   root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config+      echo '              2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config+      echo '              8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config+      echo '   key-threshold: 3'                                                            >> ${HOME}/.cabal.config -# snapshot package-db on cache miss- - if [ ! -d $HOME/.cabsnap ];-   then-      echo "snapshotting package-db to build-cache";-      mkdir $HOME/.cabsnap;-      cp -a $HOME/.ghc $HOME/.cabsnap/ghc;-      cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;-   fi+      grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' +      cabal new-update head.hackage -v+    fi+  - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'+  - if [ $HCNUMVER -eq 80403 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin hlint --constraint='hlint ==2.1.*'; fi+  - "printf 'packages: \".\"\\n' > cabal.project"+  - touch cabal.project.local+  - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg  | grep -vw -- parsers | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"+  - cat cabal.project || true+  - cat cabal.project.local || true+  - if [ -f "./configure.ac" ]; then+      (cd "." && autoreconf -i);+    fi+  - rm -f cabal.project.freeze+  - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all+  - rm -rf .ghc.environment.* "."/dist+  - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)+ # Here starts the actual work to be performed for the package under test; # any command which exits with a non-zero exit code causes the build to fail. script:- - if [ -f configure.ac ]; then autoreconf -i; fi- - cabal configure --enable-tests --enable-benchmarks -v2  # -v2 provides useful information for debugging- - cabal build   # this builds all libraries and executables (including tests/benchmarks)- - cabal test- - if [ ! $CABALVER = "1.24" ]; then cabal check; fi-# - cabal sdist   # tests that a source-distribution can be generated+  # test that source-distributions can be generated+  - (cd "." && cabal sdist)+  - mv "."/dist/parsers-*.tar.gz ${DISTDIR}/+  - cd ${DISTDIR} || false+  - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;+  - "printf 'packages: parsers-*/*.cabal\\n' > cabal.project"+  - touch cabal.project.local+  - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg  | grep -vw -- parsers | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"+  - cat cabal.project || true+  - cat cabal.project.local || true -# Check that the resulting source distribution can be built & installed.-# If there are no other `.tar.gz` files in `dist`, this can be even simpler:-# `cabal install --force-reinstalls dist/*-*.tar.gz`-# - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&-#   (cd dist && cabal install --force-reinstalls "$SRC_TGZ")+  # build & run tests, build benchmarks+  - cabal new-build -w ${HC} ${TEST} ${BENCH} all+  - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi -# Not included by generator- - hlint src --cpp-define HLINT+  # hlint+  - if [ $HCNUMVER -eq 80403 ]; then (cd parsers-* && hlint --cpp-define=HLINT src); fi -notifications:-  irc:-    channels:-      - "irc.freenode.org#haskell-lens"-    skip_join: true-    template:-      - "\x0313parsers\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"+  # cabal check+  - (cd parsers-* && cabal check) +  # haddock+  - rm -rf ./dist-newstyle+  - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi++# REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project","--hlint","--hlint-options=--cpp-define=HLINT","--allow-failure=7.0.4","--allow-failure=7.2.2"] # EOF
CHANGELOG.markdown view
@@ -1,3 +1,9 @@+0.12.9 [2018.07.04]+-------------------+* Add instances for the `Get` type from `binary`.+* Add a `surroundedBy` function, as a shorthand for `between bra ket` when+  `bra` and `ket` are the same.+ 0.12.8 ------ * Remove the `doctest` test suite, as there are no actual doctests anywhere
+ HLint.hs view
@@ -0,0 +1,4 @@+import "hint" HLint.Default++ignore "Reduce duplication"+ignore "Use String"
parsers.cabal view
@@ -1,6 +1,6 @@ name:          parsers category:      Text, Parsing-version:       0.12.8+version:       0.12.9 license:       BSD3 cabal-version: >= 1.10 license-file:  LICENSE@@ -18,17 +18,32 @@   get access to a large number of canned definitions. Instances exist for the parsers provided by @parsec@,   @attoparsec@ and base’s "Text.Read". build-type:    Simple-tested-with:   GHC==7.0.4, GHC==7.2.2, GHC==7.4.2, GHC==7.6.3, GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2+tested-with:   GHC==7.0.4+             , GHC==7.2.2+             , GHC==7.4.2+             , GHC==7.6.3+             , GHC==7.8.4+             , GHC==7.10.3+             , GHC==8.0.2+             , GHC==8.2.2+             , GHC==8.4.3+             , GHC==8.6.1  extra-source-files:   .travis.yml   CHANGELOG.markdown   README.markdown+  HLint.hs  source-repository head   type: git   location: git://github.com/ekmett/parsers.git +flag binary+  default: True+  description:+    You can disable the use of the `binary` package using `-f-binary`.+ library   default-language: Haskell2010   exposed-modules:@@ -51,7 +66,7 @@     base                 >= 4.3      && < 5,     base-orphans         >= 0.3      && < 1,     charset              >= 0.3      && < 1,-    containers           >= 0.4      && < 0.6,+    containers           >= 0.4      && < 0.7,     semigroups           >= 0.12     && < 1,     parsec               >= 3.1      && < 3.2,     attoparsec           >= 0.12.1.4 && < 0.14,@@ -60,6 +75,9 @@     mtl                  >= 2.0.1    && < 2.3,     scientific           >= 0.3      && < 0.4,     unordered-containers >= 0.2      && < 0.3++  if flag(binary)+    build-depends: binary >= 0.7.2 && < 1  test-suite quickcheck   type:    exitcode-stdio-1.0
src/Text/Parser/Combinators.hs view
@@ -38,6 +38,7 @@   , optional -- from Control.Applicative, parsec optionMaybe   , skipOptional -- parsec optional   , between+  , surroundedBy   , some     -- from Control.Applicative, parsec many1   , many     -- from Control.Applicative   , sepBy@@ -84,6 +85,11 @@ import qualified Data.Attoparsec.Combinator as Att import qualified Text.ParserCombinators.ReadP as ReadP +#ifdef MIN_VERSION_binary+import Control.Monad (when, unless)+import qualified Data.Binary.Get as B+#endif+ -- | @choice ps@ tries to apply the parsers in the list @ps@ in order, -- until one of them succeeds. Returns the value of the succeeding -- parser.@@ -115,6 +121,12 @@ between bra ket p = bra *> p <* ket {-# INLINE between #-} +-- | @p \`surroundedBy\` f@ is @p@ surrounded by @f@. Shortcut for @between f f p@.+-- As in @between@, returns the value returned by @p@.+surroundedBy :: Applicative m => m a -> m sur -> m a+surroundedBy p bound = between bound bound p+{-# INLINE surroundedBy #-}+ -- | @sepBy p sep@ parses /zero/ or more occurrences of @p@, separated -- by @sep@. Returns a list of values returned by @p@. --@@ -424,6 +436,18 @@   unexpected      = fail   eof             = Att.endOfInput   notFollowedBy p = optional p >>= maybe (pure ()) (unexpected . show)++#ifdef MIN_VERSION_binary+instance Parsing B.Get where+  try             = id+  (<?>)           = flip B.label+  skipMany p      = do skipped <- True <$ p <|> pure False+                       when skipped $ skipMany p+  unexpected      = fail+  eof             = do isEof <- B.isEmpty+                       unless isEof $ fail "Parsing.eof"+  notFollowedBy p = optional p >>= maybe (pure ()) (unexpected . show)+#endif  instance Parsing ReadP.ReadP where   try        = id
src/Text/Parser/LookAhead.hs view
@@ -45,6 +45,10 @@ import qualified Text.Parsec as Parsec import Text.Parser.Combinators +#ifdef MIN_VERSION_binary+import qualified Data.Binary.Get as B+#endif+ -- | Additional functionality needed to describe parsers independent of input type. class Parsing m => LookAheadParsing m where   -- | @lookAhead p@ parses @p@ without consuming any input.@@ -87,6 +91,11 @@  instance Att.Chunk i => LookAheadParsing (Att.Parser i) where   lookAhead = Att.lookAhead++#ifdef MIN_VERSION_binary+instance LookAheadParsing B.Get where+  lookAhead = B.lookAhead+#endif  instance LookAheadParsing ReadP.ReadP where   lookAhead p = ReadP.look >>= \s ->
src/Text/Parser/Token.hs view
@@ -110,7 +110,7 @@ import Data.Scientific ( Scientific ) import qualified Data.Scientific as Sci import Data.String-import Data.Text hiding (empty,zip,foldl,foldl',take,map,length,splitAt,null,transpose)+import Data.Text hiding (empty,zip,foldl',take,map,length,splitAt,null,transpose) import Numeric (showIntAtBase) import qualified Text.ParserCombinators.ReadP as ReadP import qualified Text.Parsec as Parsec