https://github.com/zio/zio-parser
https://github.com/zio/zio-parser
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zio/zio-parser
- Owner: zio
- License: apache-2.0
- Created: 2021-09-22T18:17:04.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-17T23:50:16.000Z (over 1 year ago)
- Last Synced: 2024-04-23T05:29:27.746Z (over 1 year ago)
- Language: Scala
- Homepage: https://zio.dev/zio-parser
- Size: 6.03 MB
- Stars: 28
- Watchers: 8
- Forks: 16
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[//]: # (This file was autogenerated using `zio-sbt-website` plugin via `sbt generateReadme` command.)
[//]: # (So please do not edit it manually. Instead, change "docs/index.md" file or sbt setting keys)
[//]: # (e.g. "readmeDocumentation" and "readmeSupport".)# ZIO Parser
Library for constructing parsers and pretty printers based on invertible syntax descriptions
[](https://github.com/zio/zio/wiki/Project-Stages)  [](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-parser_3/) [](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-parser_3/) [](https://javadoc.io/doc/dev.zio/zio-parser-docs_3) [](https://github.com/zio/zio-parser)
## Introduction
[](https://www.youtube.com/watch?v=DEPpL9LBiyA)
## Installation
Start by adding `zio-parser` as a dependency to your project:
```scala
libraryDependencies += "dev.zio" %% "zio-parser" % "0.1.9"
```## Getting Started
```scala
import zio.parser.*
```Declare your parsing syntax:
```scala
val digitSyntax: Syntax[String, Char, Char, Char] = Syntax.digit
```Parse your string:
```scala
val result: Either[StringParserError[String], Char] = digitSyntax.parseString("1")
// result: Either[StringParserError[String], Char] = Right(value = '1')
```Pretty print the parsing errors:
```scala
println(digitSyntax.parseString("Hello").left.map(_.pretty).merge)
// Hello
// ^
// error: Failure at position 0: not a digit
//
```[//]: # (TODO: Add example section)
[//]: # (## Example)## Documentation
Learn more on the [ZIO Parser homepage](https://zio.dev/zio-parser/)!
## Contributing
For the general guidelines, see ZIO [contributor's guide](https://zio.dev/about/contributing).
## Code of Conduct
See the [Code of Conduct](https://zio.dev/about/code-of-conduct)
## Support
Come chat with us on [![Badge-Discord]][Link-Discord].
[Badge-Discord]: https://img.shields.io/discord/629491597070827530?logo=discord "chat on discord"
[Link-Discord]: https://discord.gg/2ccFBr4 "Discord"## License
[License](LICENSE)