snail 0.1.0.0 → 0.1.1.0
raw patch · 3 files changed
+16/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Snail.IO: parseSnail :: Text -> Either String [SnailAst]
Files
- CHANGELOG.md +5/−0
- snail.cabal +2/−1
- src/Snail/IO.hs +9/−1
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+### Version 0.1.1.0++Introduce mechanism for reading text as snail AST++* Added parseSnail to Snail.IO
snail.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: snail-version: 0.1.0.0+version: 0.1.1.0 synopsis: A programming language with no semantics description: An s-expression parser and abstract syntax tree for a programming language with no semantics. If you wanted to write an interpreter or compiler you convert the AST into your own. category: Parsing@@ -19,6 +19,7 @@ build-type: Simple extra-source-files: README.md+ CHANGELOG.md data-files: snail-files/basic.snail snail-files/fail-comment.snail
src/Snail/IO.hs view
@@ -1,5 +1,7 @@ module Snail.IO where +import Data.Text (Text)+import Data.Text qualified as Text import Data.Text.IO qualified as Text import Snail.Lexer import Text.Megaparsec@@ -10,4 +12,10 @@ contents <- Text.readFile fp pure $ case parse snailAst (show fp) contents of Left parseErrorBundle -> Left $ errorBundlePretty parseErrorBundle- Right sexprs -> Right sexprs+ Right asts -> Right asts++parseSnail :: Text -> Either String [SnailAst]+parseSnail input =+ case parse snailAst (Text.unpack input) input of+ Left parseErrorBundle -> Left $ errorBundlePretty parseErrorBundle+ Right asts -> Right asts