]> Git — Sourcephile - haskell/symantic-parser.git/blob - parsers/Parsers/Brainfuck/SymanticParser.hs
rename {catcher => onException}
[haskell/symantic-parser.git] / parsers / Parsers / Brainfuck / SymanticParser.hs
1 {-# LANGUAGE AllowAmbiguousTypes #-}
2 {-# LANGUAGE ScopedTypeVariables #-}
3 {-# LANGUAGE TemplateHaskell #-}
4 {-# LANGUAGE TypeApplications #-}
5 {-# LANGUAGE ViewPatterns #-}
6 -- for Symantic.Parser's TemplateHaskell
7 {-# LANGUAGE MagicHash #-}
8 {-# LANGUAGE ScopedTypeVariables #-}
9 {-# LANGUAGE RankNTypes #-}
10 {-# LANGUAGE UnboxedTuples #-}
11 {-# OPTIONS_GHC -Wno-unused-matches #-}
12 {-# OPTIONS_GHC -Wno-unused-local-binds #-}
13 module Parsers.Brainfuck.SymanticParser
14 ( module Parsers.Brainfuck.SymanticParser
15 , module Parsers.Brainfuck.SymanticParser.Grammar
16 ) where
17
18 import Data.Either (Either)
19 import Data.String (String)
20 import qualified Data.ByteString as BS
21 import qualified Data.ByteString.Lazy as BSL
22 import qualified Data.Text as T
23 --import qualified Data.Text.Lazy as TL
24 import qualified Symantic.Parser as SP
25
26 -- 'grammar' must be in an another module because of GHC's stage restriction.
27 import Parsers.Brainfuck.SymanticParser.Grammar (grammar)
28 import Parsers.Brainfuck.Types (Instruction)
29
30 parserByteString :: BS.ByteString -> Either (SP.ParsingError BS.ByteString) [Instruction]
31 parserByteString = $$(SP.runParser @BS.ByteString grammar)
32
33 parserByteStringLazy :: BSL.ByteString -> Either (SP.ParsingError BSL.ByteString) [Instruction]
34 parserByteStringLazy = $$(SP.runParser @BSL.ByteString grammar)
35
36 parserString :: String -> Either (SP.ParsingError String) [Instruction]
37 parserString = $$(SP.runParser @String grammar)
38
39 parserText :: T.Text -> Either (SP.ParsingError T.Text) [Instruction]
40 parserText = $$(SP.runParser @T.Text grammar)
41
42 --parserTextLazy :: TL.Text -> Either (SP.ParsingError TL.Text) [Instruction]
43 --parserTextLazy = $$(SP.runParser @TL.Text grammar)