packages feed

grammar-combinators 0.2.4 → 0.2.5

raw patch · 3 files changed

+20/−8 lines, 3 files

Files

Text/GrammarCombinators/Parser/UUParse.hs view
@@ -35,16 +35,19 @@ import Text.GrammarCombinators.Transform.UnfoldRecursion import Text.GrammarCombinators.Transform.UnfoldLoops -import Text.ParserCombinators.UU hiding (Token)+import Text.ParserCombinators.UU+import Text.ParserCombinators.UU.BasicInstances  import Data.Enumerable (enumerate) +newtype Loc = MkLoc Int deriving Show+ -- We just count tokens for now (not lines and colums with handling here for newlines etc),  -- locations cannot be used atm anyway...-instance IsLocationUpdatedBy Int t where-   advance p _ = p + 1+instance IsLocationUpdatedBy Loc t where+   advance (MkLoc p) _ = MkLoc $ p + 1 -newtype WrapP t v = WP { unWP :: P (Str (ConcreteToken t) Int) v }+newtype WrapP t v = WP { unWP :: P (Str (ConcreteToken t) [ConcreteToken t] Loc) v }  instance (Token t) => ProductionRule (WrapP t) where   a >>> b = WP $ unWP a <*> unWP b@@ -63,8 +66,8 @@     let       sat :: ConcreteToken t -> Bool       sat t = classify t == tt-    in WP $ pSym (sat, show tt, head $ enumConcreteTokens tt)-  anyToken = WP $ pSym (const True :: ConcreteToken t -> Bool, "anyToken", head $ enumConcreteTokens (head enumerate :: t))+    in WP $ pSatisfy sat $ Insertion (show tt) (head $ enumConcreteTokens tt) 1+  anyToken = WP $ pSatisfy (const True :: ConcreteToken t -> Bool) $ Insertion "anyToken" (head $ enumConcreteTokens (head enumerate :: t)) 1  -- | Parse a given string according to a given regular grammar, starting from a given -- start symbol using the UUParse error-correcting parsing library (always@@ -91,7 +94,7 @@            RegularRule phi r t v ->            [ConcreteToken t] -> v parseUURule rule s = -  parse (unWP rule <* pEnd) $ listToStr s 0+  parse (unWP rule <* pEnd) $ createStr (MkLoc 0) s   -- | Parse a given string according to a given extended grammar, starting from a given -- start symbol using the UUParse error-correcting parsing library (always
changelog view
@@ -1,4 +1,13 @@ -*-change-log-*- +0.2.5 Fix compatibility with non-backwards compatible UUParse 2.7.1.++0.2.4 Grammar-combinators v0.2.4 is released. Home page back to+  projects.haskell.org.++0.2.3 Grammar-combinators v0.2.3 is released. Changed home page+  because of unavailability of projects.haskell.org. Small fix for+  backward compatibility with GHC 6.+ 0.2.2 Dominique Devriese <dominique.devriese@gmail.com> Jan 2011 	* Make it compile with GHC 7
grammar-combinators.cabal view
@@ -1,5 +1,5 @@ Name:                grammar-combinators-Version:             0.2.4+Version:             0.2.5 Description:     The grammar-combinators library is a novel parsing library using     an explicit representation of recursion to provide various novel