BNFC-meta 0.6 → 0.6.1
raw patch · 2 files changed
+12/−9 lines, 2 filesdep +faildep ~template-haskellnew-uploader
Dependencies added: fail
Dependency ranges changed: template-haskell
Files
- BNFC-meta.cabal +6/−5
- Language/LBNF/Runtime.hs +6/−4
BNFC-meta.cabal view
@@ -1,12 +1,12 @@ Name: BNFC-meta-version: 0.6+version: 0.6.1 cabal-Version: >= 1.6 build-type: Simple license: GPL-2 license-file: LICENSE author: Jonas Duregård-maintainer: Jonas Duregård (jonas.duregard@chalmers.se)-category: Development+maintainer: Artem Pelenitsyn <artem.pelenitsyn@gmail.com>+category: Development, parsing, text, language synopsis: Deriving Parsers and Quasi-Quoters from BNF Grammars description: This package provides a very simple way of defining a compiler front-end for a language by embedding a BNF grammar directly into a Haskell @@ -39,14 +39,15 @@ source-repository head type: git- location: https://github.com/JonasDuregard/BNFC-meta+ location: https://github.com/ulysses4ever/BNFC-meta Library Build-Depends: base>=4.2&&<5 , array>=0.4&&<0.6- , template-haskell >=2.12 && < 2.13+ , fail >=4.9&&<5+ , template-haskell >=2.12 && < 2.16 , haskell-src-meta >= 0.5 && < 1.0 , happy-meta >= 0.2.0.4 && < 0.3 , alex-meta >= 0.3.0.5 && < 0.4
Language/LBNF/Runtime.hs view
@@ -27,7 +27,7 @@ import Control.Monad (MonadPlus(..), liftM, foldM, (>=>), ap) import Control.Applicative ( Applicative(..) )-+import qualified Control.Monad.Fail as Fail import Data.Char @@ -43,10 +43,12 @@ instance Monad ParseMonad where return = Ok- fail = Bad Ok a >>= f = f a Bad s >>= f = Bad s +instance Fail.MonadFail ParseMonad where+ fail = Bad+ instance Functor ParseMonad where fmap = liftM @@ -90,8 +92,8 @@ "}" :ts -> new (i-1) . showChar '}' . new (i-1) . rend (i-1) ts ";" :ts -> showChar ';' . new i . rend i ts t : "," :ts -> showString t . space "," . rend i ts- t : ")" :ts -> showString t . showChar ')' . rend i ts- t : "]" :ts -> showString t . showChar ']' . rend i ts+ t : ")" :ts -> showString t . rend i (")":ts)+ t : "]" :ts -> showString t . rend i ("]":ts) t :ts -> space t . rend i ts _ -> id new i = showChar '\n' . replicateS (2*i) (showChar ' ') . dropWhile isSpace