summaryrefslogtreecommitdiff
path: root/lore/Language/Bs/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lore/Language/Bs/Parser.hs')
-rw-r--r--lore/Language/Bs/Parser.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/lore/Language/Bs/Parser.hs b/lore/Language/Bs/Parser.hs
index 6e004ef..3044a60 100644
--- a/lore/Language/Bs/Parser.hs
+++ b/lore/Language/Bs/Parser.hs
@@ -1,19 +1,23 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE NoImplicitPrelude #-}
module Language.Bs.Parser (
- readExpr,
- readExprFile
+ readExpr
+, readExprFile
) where
+import Control.Monad (fail)
+import Control.Monad (mzero)
+import Data.Char (digitToInt)
+import Data.Functor.Identity (Identity)
+import Data.String
+import qualified Data.Text as T
import Language.Bs.Expr
+import Protolude hiding ((<|>), try)
import Text.Parsec
+import qualified Text.Parsec.Language as Lang
import Text.Parsec.Text
import qualified Text.Parsec.Token as Tok
-import qualified Text.Parsec.Language as Lang
-import Data.Functor.Identity (Identity)
-import qualified Data.Text as T
-import Data.Char (digitToInt)
-import Control.Monad (mzero)
lexer :: Tok.GenTokenParser T.Text () Identity
lexer = Tok.makeTokenParser style
@@ -67,8 +71,8 @@ decimal = Tok.decimal lexer
-- Copied from Text.Parsec.Token
sign :: Parser (Integer -> Integer)
sign = char '-' *> return negate
- <|> char '+' *> return id
- <|> return id
+ <|> char '+' *> return identity
+ <|> return identity
intRadix :: Radix -> Parser Integer
intRadix r = sign <*> numberWithRadix r