parser-unbiased-choice-monad-embedding 0.0.0.1 → 0.0.0.2
raw patch · 3 files changed
+6/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog +1/−0
- ParserUnbiasedChoiceMonadEmbedding.hs +3/−2
- parser-unbiased-choice-monad-embedding.cabal +2/−2
ChangeLog view
@@ -0,0 +1,1 @@+0.0.0.2: Docs and comments
ParserUnbiasedChoiceMonadEmbedding.hs view
@@ -104,6 +104,7 @@ showLoc NoLoc = "-:1:1-1:1" showLoc (Loc (Pos file line1 col1 _) (Pos _ line2 col2 _)) = file ++ ":" ++ show line1 ++ ":" ++ show col1 ++ "-" ++ show line2 ++ ":" ++ show col2 +-- | This function is buggy: if a file contains no tokens, the file name will not be returned positionToLoc :: [L a] -> Int -> Loc positionToLoc list position = if position < length list then let L l _ = list !! position in l else if position == 0 then NoLoc else let L l _ = list !! (position - 1) in l @@ -121,7 +122,7 @@ >>> import ParserUnbiasedChoiceMonadEmbedding >>> :{ grammar :: Grammar r (ArrowProd r () String (Either String) () Int)-grammar = mdo { -- RecursiveDo+grammar = mdo { num <- arrowRule $ msym $ \tok -> if all (`elem` ['0'..'9']) tok then Just $ read tok else Nothing; term <- arrowRule $ num <|> (sym "(" *> expr <* sym ")"); expr <- arrowRule $ term <|> ((*) <$> (expr <* sym "*") <*> term) <|> (proc () -> do {@@ -133,7 +134,7 @@ }); return expr; }-lexer :: Lexer String -- Trivial lexer similar to "words"+lexer :: Lexer String lexer = mconcat [ token $ longest $ many $ psym (/= ' '), whitespace $ longest $ string " "
parser-unbiased-choice-monad-embedding.cabal view
@@ -1,10 +1,10 @@ cabal-version: 3.0 name: parser-unbiased-choice-monad-embedding-version: 0.0.0.1+version: 0.0.0.2 synopsis: Parsing combinator library with unbiased choice and support for embedding arbitrary monad. You may use applicative or arrow style. Supports left recursion, location tracking, parsing and semantic error messages, heuristic ambiguity checking. Based on Earley description: Parsing combinator library with unbiased choice and support for embedding arbitrary monad. You may use applicative or arrow style. Supports left recursion, location tracking, parsing and semantic error messages, heuristic ambiguity checking. Based on Earley. - Follow thread https://mail.haskell.org/pipermail/haskell-cafe/2021-June/134094.html for more info.+ See announcement https://mail.haskell.org/pipermail/haskell-cafe/2021-July/134205.html for more info. You don't need to be registered on SourceHut to create bug report.