uu-parsinglib 2.7.3 → 2.7.3.1
raw patch · 3 files changed
+12/−7 lines, 3 files
Files
- src/Text/ParserCombinators/UU/CHANGELOG.hs +4/−0
- src/Text/ParserCombinators/UU/Core.hs +7/−6
- 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.3.1+--+-- fixed corner case when combining to failing parsers during grammar analysis; probably useful error message is now gone+-- -- Version 2.7.3 -- -- better behaviour when inserting at end of input
src/Text/ParserCombinators/UU/Core.hs view
@@ -185,9 +185,10 @@ -- | `mkParser` combines the non-empty descriptor part and the empty descriptor part into a descriptor tupled with the parser triple mkParser :: Maybe (T st a) -> Maybe a -> Nat -> P st a mkParser np ne l = P (mkParser' np ne) np l ne- where mkParser' np@(Just nt) ne@Nothing = nt - mkParser' np@Nothing ne@(Just a) = pure a - mkParser' np@(Just nt) ne@(Just a) = nt <|> pure a+ where mkParser' np@(Just nt) ne@Nothing = nt + mkParser' np@Nothing ne@(Just a) = pure a + mkParser' np@(Just nt) ne@(Just a) = nt <|> pure a+ mkParser' np@(Nothing) ne@(Nothing) = empty -- ! `combine` creates the non-empty parser combine :: (Alternative f) => Maybe t1 -> Maybe t2 -> t -> Maybe t3@@ -381,12 +382,12 @@ -- By default we use the future parser, since this gives us access to partal -- result; future parsers are expected to run in less space. parse :: (Eof t) => P t a -> t -> a-parse (P (T _ pf _) _ _ _) = fst . eval . pf (\ rest -> if eof rest then Step 0 (Step 0 (Step 0 (Step 0 (error "ambiguous parser?")))) +parse (P (T _ pf _) _ _ _) = fst . eval . pf (\ rest -> if eof rest then Step 0 ( Step 0 (Step 0 (Step 0 (Step 0 (error "ambiguous parser?"))))) else error "pEnd missing?") -- | The function @`parse_h`@ behaves like @`parse`@ but using the history -- parser. This parser does not give online results, but might run faster. parse_h :: (Eof t) => P t a -> t -> a-parse_h (P (T ph _ _) _ _ _) = fst . eval . ph (\ a rest -> if eof rest then push a (Step 0 (Step 0 (Step 0 (Step 0 (error "ambiguous parser?"))))) +parse_h (P (T ph _ _) _ _ _) = fst . eval . ph (\ a rest -> if eof rest then push a (Step 0 (Step 0 (Step 0 (Step 0 (Step 0 (error "ambiguous parser?"))))) ) else error "pEnd missing?") -- | The data type `Steps` is the core data type around which the parsers are constructed.@@ -451,7 +452,7 @@ eval :: Steps a -> a eval (Step n l) = {- trace ("Step " ++ show n ++ "\n")-} (eval l) eval (Micro _ l) = eval l-eval (Fail ss ls ) = trace' ("expecting: " ++ show ss) (eval (getCheapest 3 (map ($ss) ls))) +eval (Fail ss ls ) = trace' ("expecting: " ++ show ss) (eval (getCheapest 5 (map ($ss) ls))) eval (Apply f l ) = f (eval l) eval (End_f _ _ ) = error "dangling End_f constructor" eval (End_h _ _ ) = error "dangling End_h constructor"
uu-parsinglib.cabal view
@@ -1,5 +1,5 @@ Name: uu-parsinglib-Version: 2.7.3+Version: 2.7.3.1 Build-Type: Simple License: MIT Copyright: S Doaitse Swierstra