uu-cco-uu-parsinglib (empty) → 0.1.0.0
raw patch · 5 files changed
+82/−0 lines, 5 filesdep +ListLikedep +basedep +uu-ccosetup-changed
Dependencies added: ListLike, base, uu-cco, uu-parsinglib
Files
- AUTHORS +2/−0
- LICENSE +1/−0
- Setup.lhs +4/−0
- src/CCO/Parsing/UUParsingLib.hs +47/−0
- uu-cco-uu-parsinglib.cabal +28/−0
+ AUTHORS view
@@ -0,0 +1,2 @@+Stefan Holdermans <stefan@holdermans.nl> (Original author)+Atze Dijkstra <atze@uu.nl> (Maintainer)
+ LICENSE view
@@ -0,0 +1,1 @@+Copyright (c) 2008-2014 Utrecht University. All rights reserved.
+ Setup.lhs view
@@ -0,0 +1,4 @@+#! /usr/bin/env runhaskell++> import Distribution.Simple+> main = defaultMain
+ src/CCO/Parsing/UUParsingLib.hs view
@@ -0,0 +1,47 @@+-------------------------------------------------------------------------------+-- |+-- Module : CCO.Parsing.UU+-- Copyright : (c) 2008 Utrecht University+-- License : All rights reserved+--+-- Maintainer : stefan@cs.uu.nl+-- Stability : provisional+-- Portability : portable+--+-- Utility for executing 'Parser's from the uu-parsinglib package+-- within the 'Feedback' monad.+--+-- This module can be regarded a satellite to the utility library accompanying+-- the course on Compiler Construction (INFOMCCO) at Utrecht University.+--+-------------------------------------------------------------------------------++module CCO.Parsing.UUParsingLib (+ -- * Executing parsers within the Feedback monad+ parseFeedback + +) where++import Text.ParserCombinators.UU+import Text.ParserCombinators.UU.BasicInstances+import Text.ParserCombinators.UU.Utils+import CCO.Feedback+import qualified Data.ListLike as LL++-------------------------------------------------------------------------------+-- Executing parsers within the Feedback monad+-------------------------------------------------------------------------------++-- | Executes a 'Parser' within the 'Feedback' monad.+parseFeedback+ :: (LL.ListLike [s] Char)+ => Parser a -- ^ the parser to use+ -> [s] -- ^ the input+ -> Feedback a -- ^ return result in Feedback+parseFeedback p inp = do + let r@(a, errors) = parse ( (,) <$> p <*> pEnd) (createStr (LineColPos 0 0 0) inp)+ if null errors then return ()+ else do sequence $ map (warn_ . show) errors+ return ()+ return a +
+ uu-cco-uu-parsinglib.cabal view
@@ -0,0 +1,28 @@+name: uu-cco-uu-parsinglib+version: 0.1.0.0+synopsis: Utilities for compiler construction+description: A small utility library accompanying the course on+ Compiler Construction (INFOMCCO) at Utrecht Univerity.+license: BSD3+license-file: LICENSE+category: Compilers/Interpreters+copyright: (c) 2008-2014 Utrecht University+author: Stefan Holdermans <stefan@holdermans.nl>+maintainer: Atze Dijkstra <atze@uu.nl>+stability: provisional+homepage: https://github.com/UU-ComputerScience/uu-cco+build-type: Simple+cabal-version: >= 1.6+extra-source-files: AUTHORS++source-repository head+ type: git+ location: git://github.com/UU-ComputerScience/uu-cco.git++library+ build-depends: base >= 4 && < 5, uu-parsinglib >= 2.8.1, uu-cco >= 0.1.0.0, ListLike >= 4.0.2+ exposed-modules: CCO.Parsing.UUParsingLib+ other-modules: + extensions: RankNTypes, FlexibleContexts+ hs-source-dirs: src+