diff options
author | Kosyrev Serge <serge.kosyrev@iohk.io> | 2018-01-16 03:13:11 +0300 |
---|---|---|
committer | Kosyrev Serge <serge.kosyrev@iohk.io> | 2018-01-16 03:13:11 +0300 |
commit | 288b92a732c27ddeaccef6469ee065ffde787988 (patch) | |
tree | 3afc70fe10a6f26cc867658fcf2127cb222db251 | |
parent | f844c6f6179eb0a9a0921e26d59cd7fca40520d7 (diff) |
megaparsec 6.3 compat
-rw-r--r-- | src/LambdaCube/Compiler/Lexer.hs | 12 | ||||
-rw-r--r-- | src/LambdaCube/Compiler/Parser.hs | 2 | ||||
-rw-r--r-- | src/LambdaCube/Compiler/Utils.hs | 1 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/LambdaCube/Compiler/Lexer.hs b/src/LambdaCube/Compiler/Lexer.hs index ac7f7f71..c3f4e285 100644 --- a/src/LambdaCube/Compiler/Lexer.hs +++ b/src/LambdaCube/Compiler/Lexer.hs | |||
@@ -17,15 +17,17 @@ import Data.List | |||
17 | import Data.List.NonEmpty (fromList) | 17 | import Data.List.NonEmpty (fromList) |
18 | import Data.Char | 18 | import Data.Char |
19 | import qualified Data.Set as Set | 19 | import qualified Data.Set as Set |
20 | import Data.Void | ||
20 | import Control.Monad.Except | 21 | import Control.Monad.Except |
21 | import Control.Monad.RWS | 22 | import Control.Monad.RWS |
22 | import Control.Applicative | 23 | import Control.Applicative |
23 | import Control.Arrow | 24 | import Control.Arrow |
24 | 25 | ||
25 | import Text.Megaparsec hiding (State, ParseError) | 26 | import Text.Megaparsec hiding (State, ParseError) |
27 | import Text.Megaparsec.Char | ||
28 | import Text.Megaparsec.Char.Lexer hiding (lexeme, symbol) | ||
26 | import qualified Text.Megaparsec as P | 29 | import qualified Text.Megaparsec as P |
27 | import Text.Megaparsec as ParseUtils hiding (try, Message, State, ParseError) | 30 | import Text.Megaparsec as ParseUtils hiding (try, Message, State, ParseError, lexeme, symbol) |
28 | import Text.Megaparsec.Lexer hiding (lexeme, symbol, negate) | ||
29 | 31 | ||
30 | import LambdaCube.Compiler.Pretty hiding (parens) | 32 | import LambdaCube.Compiler.Pretty hiding (parens) |
31 | import LambdaCube.Compiler.DesugaredSource | 33 | import LambdaCube.Compiler.DesugaredSource |
@@ -114,12 +116,12 @@ data ParseEnv r = ParseEnv | |||
114 | type ParseState r = (ParseEnv r, P.State String) | 116 | type ParseState r = (ParseEnv r, P.State String) |
115 | 117 | ||
116 | parseState :: FileInfo -> r -> ParseState r | 118 | parseState :: FileInfo -> r -> ParseState r |
117 | parseState fi di = (ParseEnv fi di ExpNS (SPos 0 0), either (error "impossible") id $ runParser (getParserState :: Parsec Dec String (P.State String)) (filePath fi) (fileContent fi)) | 119 | parseState fi di = (ParseEnv fi di ExpNS (SPos 0 0), either (error "impossible") id $ runParser (getParserState :: Parsec (ErrorFancy Void) String (P.State String)) (filePath fi) (fileContent fi)) |
118 | 120 | ||
119 | --type Parse r w = ReaderT (ParseEnv r) (WriterT [w] (StateT SPos (Parsec String))) | 121 | --type Parse r w = ReaderT (ParseEnv r) (WriterT [w] (StateT SPos (Parsec String))) |
120 | type Parse r w = RWST (ParseEnv r) [w] SPos (Parsec Dec String) | 122 | type Parse r w = RWST (ParseEnv r) [w] SPos (Parsec (ErrorFancy Void) String) |
121 | 123 | ||
122 | newtype ParseError = ParseErr (P.ParseError (Token String) Dec) | 124 | newtype ParseError = ParseErr (P.ParseError (Token String) (ErrorFancy Void)) |
123 | 125 | ||
124 | instance Show ParseError where | 126 | instance Show ParseError where |
125 | show (ParseErr e) = parseErrorPretty e | 127 | show (ParseErr e) = parseErrorPretty e |
diff --git a/src/LambdaCube/Compiler/Parser.hs b/src/LambdaCube/Compiler/Parser.hs index 70e7b98c..752d7957 100644 --- a/src/LambdaCube/Compiler/Parser.hs +++ b/src/LambdaCube/Compiler/Parser.hs | |||
@@ -38,6 +38,8 @@ import LambdaCube.Compiler.DesugaredSource | |||
38 | import LambdaCube.Compiler.Patterns | 38 | import LambdaCube.Compiler.Patterns |
39 | import LambdaCube.Compiler.Statements | 39 | import LambdaCube.Compiler.Statements |
40 | 40 | ||
41 | import Text.Megaparsec.Char | ||
42 | |||
41 | -------------------------------------------------------------------------------- parser type | 43 | -------------------------------------------------------------------------------- parser type |
42 | 44 | ||
43 | type BodyParser = Parse DesugarInfo PostponedCheck | 45 | type BodyParser = Parse DesugarInfo PostponedCheck |
diff --git a/src/LambdaCube/Compiler/Utils.hs b/src/LambdaCube/Compiler/Utils.hs index 4e9eab27..42a63843 100644 --- a/src/LambdaCube/Compiler/Utils.hs +++ b/src/LambdaCube/Compiler/Utils.hs | |||
@@ -24,7 +24,6 @@ import Control.Monad.RWS | |||
24 | import System.Directory | 24 | import System.Directory |
25 | import qualified Data.Text.IO as TIO | 25 | import qualified Data.Text.IO as TIO |
26 | import qualified Text.Megaparsec as P | 26 | import qualified Text.Megaparsec as P |
27 | import qualified Text.Megaparsec.Prim as P | ||
28 | 27 | ||
29 | ------------------------------------------------------- general functions | 28 | ------------------------------------------------------- general functions |
30 | 29 | ||