add support for megaparsec 8 (#1175)

This commit is contained in:
Simon Michael 2020-01-14 09:54:06 -08:00
parent 473b3376ab
commit 445e8aa3cc
9 changed files with 28 additions and 19 deletions

View File

@ -1,4 +1,5 @@
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-} -- new {-# LANGUAGE FlexibleInstances #-} -- new
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
@ -176,7 +177,12 @@ reparseExcerpt (SourceExcerpt offset txt) p = do
Left errBundle -> customFailure $ ErrorReparsing $ bundleErrors errBundle Left errBundle -> customFailure $ ErrorReparsing $ bundleErrors errBundle
where where
offsetInitialState :: Int -> s -> State s offsetInitialState :: Int -> s ->
#if MIN_VERSION_megaparsec(8,0,0)
State s e
#else
State s
#endif
offsetInitialState initialOffset s = State offsetInitialState initialOffset s = State
{ stateInput = s { stateInput = s
, stateOffset = initialOffset , stateOffset = initialOffset
@ -187,6 +193,9 @@ reparseExcerpt (SourceExcerpt offset txt) p = do
, pstateTabWidth = defaultTabWidth , pstateTabWidth = defaultTabWidth
, pstateLinePrefix = "" , pstateLinePrefix = ""
} }
#if MIN_VERSION_megaparsec(8,0,0)
, stateParseErrors = []
#endif
} }
--- * Pretty-printing custom parse errors --- * Pretty-printing custom parse errors

View File

@ -4,7 +4,7 @@ cabal-version: 1.12
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: 7338b387492cf1c078ae62d4f4c50859589b0a5549943203856880918b67d202 -- hash: 440daf47cc4866a3723004ada26f77ffdb86d985e23844649c9a5977232a3edd
name: hledger-lib name: hledger-lib
version: 1.16.99 version: 1.16.99
@ -128,7 +128,7 @@ library
, file-embed >=0.0.10 , file-embed >=0.0.10
, filepath , filepath
, hashtables >=1.2.3.1 , hashtables >=1.2.3.1
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, old-time , old-time
, parsec >=3 , parsec >=3
@ -180,7 +180,7 @@ test-suite doctest
, file-embed >=0.0.10 , file-embed >=0.0.10
, filepath , filepath
, hashtables >=1.2.3.1 , hashtables >=1.2.3.1
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, old-time , old-time
, parsec >=3 , parsec >=3
@ -235,7 +235,7 @@ test-suite unittest
, filepath , filepath
, hashtables >=1.2.3.1 , hashtables >=1.2.3.1
, hledger-lib , hledger-lib
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, old-time , old-time
, parsec >=3 , parsec >=3

View File

@ -61,7 +61,7 @@ dependencies:
- file-embed >=0.0.10 - file-embed >=0.0.10
- filepath - filepath
- hashtables >=1.2.3.1 - hashtables >=1.2.3.1
- megaparsec >=7.0.0 && <8 - megaparsec >=7.0.0 && <8.1
- mtl >=2.2.1 - mtl >=2.2.1
- old-time - old-time
- parsec >=3 - parsec >=3

View File

@ -4,7 +4,7 @@ cabal-version: 1.12
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: 44e87e99fa5ad71ff9b86d3654ceb43e1d2d53151a36cf18e2b897ad54de144e -- hash: 856f791512f190b68f4f0e62e158d1dfa956f0fa5be963e591472ab2adfa2f4a
name: hledger-ui name: hledger-ui
version: 1.16.99 version: 1.16.99
@ -79,7 +79,7 @@ executable hledger-ui
, fsnotify >=0.2.1.2 && <0.4 , fsnotify >=0.2.1.2 && <0.4
, hledger >=1.16.99 && <1.17 , hledger >=1.16.99 && <1.17
, hledger-lib >=1.16.99 && <1.17 , hledger-lib >=1.16.99 && <1.17
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, microlens >=0.4 , microlens >=0.4
, microlens-platform >=0.2.3.1 , microlens-platform >=0.2.3.1
, pretty-show >=1.6.4 , pretty-show >=1.6.4

View File

@ -55,7 +55,7 @@ dependencies:
- fsnotify >=0.2.1.2 && <0.4 - fsnotify >=0.2.1.2 && <0.4
- microlens >=0.4 - microlens >=0.4
- microlens-platform >=0.2.3.1 - microlens-platform >=0.2.3.1
- megaparsec >=7.0.0 && <8 - megaparsec >=7.0.0 && <8.1
- pretty-show >=1.6.4 - pretty-show >=1.6.4
- process >=1.2 - process >=1.2
- safe >=0.2 - safe >=0.2

View File

@ -1,10 +1,10 @@
cabal-version: 1.12 cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.32.0. -- This file has been generated from package.yaml by hpack version 0.31.2.
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: a9a6dea39ea5c963970cda9f595e7c4251332954aacd137fb6638a1e7640ee59 -- hash: cbf332de4147396a82198ccf5173db10b775ed99f9830e89aea475bfd4da5a7f
name: hledger-web name: hledger-web
version: 1.16.99 version: 1.16.99
@ -174,7 +174,7 @@ library
, http-client , http-client
, http-conduit , http-conduit
, http-types , http-types
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, network , network
, semigroups , semigroups

View File

@ -118,7 +118,7 @@ library:
- http-conduit - http-conduit
- http-client - http-client
- http-types - http-types
- megaparsec >=7.0.0 && <8 - megaparsec >=7.0.0 && <8.1
- mtl >=2.2.1 - mtl >=2.2.1
- network - network
- semigroups - semigroups

View File

@ -4,7 +4,7 @@ cabal-version: 1.12
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: dccfd747a09ddc253d2352befe0f49e195ea409c4df838416389f0baaafab8de -- hash: 6ff98e6e17e5d1edb014822f62c4dfeb4b7aef757c434a9a45913640fcc7f845
name: hledger name: hledger
version: 1.16.99 version: 1.16.99
@ -164,7 +164,7 @@ library
, hledger-lib >=1.16.99 && <1.17 , hledger-lib >=1.16.99 && <1.17
, lucid , lucid
, math-functions >=0.2.0.0 , math-functions >=0.2.0.0
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, old-time , old-time
, parsec >=3 , parsec >=3
@ -215,7 +215,7 @@ executable hledger
, hledger , hledger
, hledger-lib >=1.16.99 && <1.17 , hledger-lib >=1.16.99 && <1.17
, math-functions >=0.2.0.0 , math-functions >=0.2.0.0
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, old-time , old-time
, parsec >=3 , parsec >=3
@ -267,7 +267,7 @@ test-suite unittest
, hledger , hledger
, hledger-lib >=1.16.99 && <1.17 , hledger-lib >=1.16.99 && <1.17
, math-functions >=0.2.0.0 , math-functions >=0.2.0.0
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, old-time , old-time
, parsec >=3 , parsec >=3
@ -318,7 +318,7 @@ benchmark bench
, hledger-lib >=1.16.99 && <1.17 , hledger-lib >=1.16.99 && <1.17
, html , html
, math-functions >=0.2.0.0 , math-functions >=0.2.0.0
, megaparsec >=7.0.0 && <8 , megaparsec >=7.0.0 && <8.1
, mtl >=2.2.1 , mtl >=2.2.1
, old-time , old-time
, parsec >=3 , parsec >=3

View File

@ -119,7 +119,7 @@ dependencies:
- extra >=1.6.3 - extra >=1.6.3
- filepath - filepath
- haskeline >=0.6 - haskeline >=0.6
- megaparsec >=7.0.0 && <8 - megaparsec >=7.0.0 && <8.1
- mtl >=2.2.1 - mtl >=2.2.1
- old-time - old-time
- parsec >=3 - parsec >=3