uu-parsinglib 2.7.1 → 2.7.1.1
raw patch · 6 files changed
+20/−20 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.ParserCombinators.UU.Demo.MergeAndPermute: pA :: Grammar String
- Text.ParserCombinators.UU.Demo.MergeAndPermute: pB :: Grammar String
- Text.ParserCombinators.UU.Demo.MergeAndPermute: pC :: Grammar String
- Text.ParserCombinators.UU.Utils: pComma :: Parser Char
- Text.ParserCombinators.UU.Utils: pDQuote :: Parser Char
- Text.ParserCombinators.UU.Utils: pDot :: Parser Char
- Text.ParserCombinators.UU.Utils: pLBrace :: Parser Char
- Text.ParserCombinators.UU.Utils: pLBracket :: Parser Char
- Text.ParserCombinators.UU.Utils: pLParen :: Parser Char
- Text.ParserCombinators.UU.Utils: pRBrace :: Parser Char
- Text.ParserCombinators.UU.Utils: pRBracket :: Parser Char
- Text.ParserCombinators.UU.Utils: pRParen :: Parser Char
+ Text.ParserCombinators.UU.Demo.MergeAndPermute: pA, pC, pB :: Grammar String
+ Text.ParserCombinators.UU.Idioms: OR :: OR
+ Text.ParserCombinators.UU.Idioms: data OR
+ Text.ParserCombinators.UU.Utils: pDot, pRBrace, pLBrace, pRBracket, pLBracket, pRParen, pLParen, pDQuote, pComma :: Parser Char
+ Text.ParserCombinators.UU.Utils: pDoubleStr :: Parser [Char]
- Text.ParserCombinators.UU.Demo.MergeAndPermute: pABC :: Grammar String
+ Text.ParserCombinators.UU.Demo.MergeAndPermute: pABC :: Grammar Char
Files
- src/Text/ParserCombinators/UU/CHANGELOG.hs +4/−0
- src/Text/ParserCombinators/UU/Core.hs +1/−14
- src/Text/ParserCombinators/UU/Demo/MergeAndPermute.hs +2/−2
- src/Text/ParserCombinators/UU/Idioms.hs +11/−3
- src/Text/ParserCombinators/UU/Utils.hs +1/−0
- uu-parsinglib.cabal +1/−1
src/Text/ParserCombinators/UU/CHANGELOG.hs view
@@ -1,5 +1,9 @@ -- | This module just contains the CHANGELOG --+-- Version 2.7.1.1+--+-- added @pDoubleStr@ to the export list of the Utils module+-- -- Version 2.7.1 -- -- fixed a subtle black hole which prevented computation of lengths!! You should upgrade.
src/Text/ParserCombinators/UU/Core.hs view
@@ -100,18 +100,6 @@ infixl 3 <<|> infixl 2 `opt` -{---- | The function `splitState` playes a crucial role in splitting up the state. --- The `symbol` parameter tells us what kind of thing, and even which value of that kind, is expected from the input.--- The @state@ and and the @symbol@ type together determine what type of @token@ is to be returned. --- Since the function is overloaded we do not have to invent all kind of different names for our elementary parsers.--- This may be a bit confusing if you are not used to this. Error messages may be a bit harder to decipher.--- The function takes as second parameter a continutation which is called with the --- recognised piece of input (the @token@) and the remaining input of type @state@.-class Provides state symbol token | state symbol -> token where- splitState :: symbol -> (token -> state -> Steps a) -> state -> Steps a--}- -- | The class `Eof` contains a function `eof` which is used to check whether we have reached the end of the input and `deletAtEnd` -- should discard any unconsumed input at the end of a successful parse. class Eof state where@@ -137,7 +125,6 @@ -- by using it in a monad, be used to control how to proceed with the parsing process. getErrors :: state -> ([error], state) - class state `HasPosition` pos | state -> pos where -- | `getPos` retrieves the correcting steps made since the last time the function was called. The result can, -- by using it as the left hand side of a monadic bind, be used to control how to proceed with the parsing process.@@ -427,7 +414,7 @@ Step :: Progress -> Steps a -> Steps a Apply :: forall a b. (b -> a) -> Steps b -> Steps a Fail :: Strings -> [Strings -> (Cost , Steps a)] -> Steps a- Micro :: Int -> Steps a -> Steps a+ Micro :: Int -> Steps a -> Steps a End_h :: ([a] , [a] -> Steps r) -> Steps (a,r) -> Steps (a, r) End_f :: [Steps a] -> Steps a -> Steps a
src/Text/ParserCombinators/UU/Demo/MergeAndPermute.hs view
@@ -124,8 +124,8 @@ -- The transaction is identified by a digit: hence a full transaction is a string like \"a5b5c5\". -- The third element in the body of `show_demos` below shows how the different transactions can be recovered from -- a log-file which contains all events generated by a collection of concurrently running transactions.-pABC :: Grammar String-pABC = (\ a d -> d:a) <$> pA <*> (pDigit' >>= \d -> pB *> mkGram (pSym d) *> pC *> mkGram (pSym d))+pABC :: Grammar Char+pABC = mkGram (pa *> pDigit ) >>= (\ d -> mkGram (pb *> pSym d) *> mkGram (pc *> pSym d))
src/Text/ParserCombinators/UU/Idioms.hs view
@@ -21,6 +21,7 @@ data THEN = THEN data ELSE = ELSE data FI = FI+data OR = OR data String' = String' {fromStr :: String}@@ -36,10 +37,16 @@ idiomatic :: P st f -> g instance Idiomatic st x (Ii -> P st x) where idiomatic ix Ii = ix+{-+instance Idiomatic st (a->a) g => Idiomatic st g OR where+ idiomatic ix OR = (ix <|>) . idiomatic (pure id)+-}+ instance Idiomatic st f g => Idiomatic st (a -> f) (P st a -> g) where idiomatic isf is = idiomatic (isf <*> is) + instance Idiomatic st f g => Idiomatic st ((a -> b) -> f) ((a -> b) -> g) where idiomatic isf f = idiomatic (isf <*> (pure f)) instance (Idiomatic (Str Char state loc) f g, IsLocationUpdatedBy loc Char, LL.ListLike state Char) @@ -47,9 +54,10 @@ idiomatic isf str = idiomatic (isf <* lexeme (pToken str)) instance (Idiomatic (Str Char state loc) f g, IsLocationUpdatedBy loc Char, LL.ListLike state Char) => Idiomatic (Str Char state loc) f (Char -> g) where- idiomatic isf c = idiomatic (isf <* pSym c)+ idiomatic isf c = idiomatic (isf <* lexeme (pSym c)) instance Idiomatic st f g => Idiomatic st (a -> f) (IF -> Bool -> THEN -> P st a -> ELSE -> P st a -> FI -> g) where idiomatic isf IF b THEN t ELSE e FI = idiomatic (isf <*> (if b then t else e))+ -- | The idea of the Idiom concept is that sequential composition operators can be inferred from the type -- of the various operands@@ -63,5 +71,5 @@ pNat = pNatural show_demos :: IO ()-show_demos = demo "(iI (+) '(' pNat \"plus\" IF True THEN pNat ELSE pNat FI ')' Ii) ::Parser Int" "(2 plus 3)" - ((iI (+) '(' pNat "plus" IF True THEN pNat ELSE pNat FI ')' Ii) ::Parser Int)+show_demos = demo "(+) <$> (iI (+) '(' pNat \"plus\" IF True THEN pNat ELSE pNat FI ')' Ii) <* lexeme (pSym '+') <*> pNat)" "(2 plus 3) + 8" + ((+) <$> (iI (+) '(' pNat "plus" IF True THEN pNat ELSE pNat FI ')' Ii) <* lexeme (pSym '+') <*> pNat)
src/Text/ParserCombinators/UU/Utils.hs view
@@ -40,6 +40,7 @@ pNaturalRaw, pIntegerRaw, pDoubleRaw,+ pDoubleStr, -- * Lexeme parsers for numbers pNatural,
uu-parsinglib.cabal view
@@ -1,5 +1,5 @@ Name: uu-parsinglib-Version: 2.7.1+Version: 2.7.1.1 Build-Type: Simple License: MIT Copyright: S Doaitse Swierstra