summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKosyrev Serge <serge.kosyrev@iohk.io>2018-01-16 03:13:11 +0300
committerKosyrev Serge <serge.kosyrev@iohk.io>2018-01-16 03:13:11 +0300
commit288b92a732c27ddeaccef6469ee065ffde787988 (patch)
tree3afc70fe10a6f26cc867658fcf2127cb222db251
parentf844c6f6179eb0a9a0921e26d59cd7fca40520d7 (diff)
megaparsec 6.3 compat
-rw-r--r--src/LambdaCube/Compiler/Lexer.hs12
-rw-r--r--src/LambdaCube/Compiler/Parser.hs2
-rw-r--r--src/LambdaCube/Compiler/Utils.hs1
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
17import Data.List.NonEmpty (fromList) 17import Data.List.NonEmpty (fromList)
18import Data.Char 18import Data.Char
19import qualified Data.Set as Set 19import qualified Data.Set as Set
20import Data.Void
20import Control.Monad.Except 21import Control.Monad.Except
21import Control.Monad.RWS 22import Control.Monad.RWS
22import Control.Applicative 23import Control.Applicative
23import Control.Arrow 24import Control.Arrow
24 25
25import Text.Megaparsec hiding (State, ParseError) 26import Text.Megaparsec hiding (State, ParseError)
27import Text.Megaparsec.Char
28import Text.Megaparsec.Char.Lexer hiding (lexeme, symbol)
26import qualified Text.Megaparsec as P 29import qualified Text.Megaparsec as P
27import Text.Megaparsec as ParseUtils hiding (try, Message, State, ParseError) 30import Text.Megaparsec as ParseUtils hiding (try, Message, State, ParseError, lexeme, symbol)
28import Text.Megaparsec.Lexer hiding (lexeme, symbol, negate)
29 31
30import LambdaCube.Compiler.Pretty hiding (parens) 32import LambdaCube.Compiler.Pretty hiding (parens)
31import LambdaCube.Compiler.DesugaredSource 33import LambdaCube.Compiler.DesugaredSource
@@ -114,12 +116,12 @@ data ParseEnv r = ParseEnv
114type ParseState r = (ParseEnv r, P.State String) 116type ParseState r = (ParseEnv r, P.State String)
115 117
116parseState :: FileInfo -> r -> ParseState r 118parseState :: FileInfo -> r -> ParseState r
117parseState 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)) 119parseState 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)))
120type Parse r w = RWST (ParseEnv r) [w] SPos (Parsec Dec String) 122type Parse r w = RWST (ParseEnv r) [w] SPos (Parsec (ErrorFancy Void) String)
121 123
122newtype ParseError = ParseErr (P.ParseError (Token String) Dec) 124newtype ParseError = ParseErr (P.ParseError (Token String) (ErrorFancy Void))
123 125
124instance Show ParseError where 126instance 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
38import LambdaCube.Compiler.Patterns 38import LambdaCube.Compiler.Patterns
39import LambdaCube.Compiler.Statements 39import LambdaCube.Compiler.Statements
40 40
41import Text.Megaparsec.Char
42
41-------------------------------------------------------------------------------- parser type 43-------------------------------------------------------------------------------- parser type
42 44
43type BodyParser = Parse DesugarInfo PostponedCheck 45type 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
24import System.Directory 24import System.Directory
25import qualified Data.Text.IO as TIO 25import qualified Data.Text.IO as TIO
26import qualified Text.Megaparsec as P 26import qualified Text.Megaparsec as P
27import qualified Text.Megaparsec.Prim as P
28 27
29------------------------------------------------------- general functions 28------------------------------------------------------- general functions
30 29