Skip to content

zio/zio-parser

Repository files navigation

ZIO Parser

Library for constructing parsers and pretty printers based on invertible syntax descriptions

Development CI Badge Sonatype Releases Sonatype Snapshots javadoc ZIO Parser

Introduction

Zymposium - ZIO Parser

Installation

Start by adding zio-parser as a dependency to your project:

libraryDependencies += "dev.zio" %% "zio-parser" % "0.1.9"

Getting Started

import zio.parser.*

Declare your parsing syntax:

val digitSyntax: Syntax[String, Char, Char, Char] = Syntax.digit

Parse your string:

val result: Either[StringParserError[String], Char] = digitSyntax.parseString("1")
// result: Either[StringParserError[String], Char] = Right(value = '1')

Pretty print the parsing errors:

println(digitSyntax.parseString("Hello").left.map(_.pretty).merge)
// Hello
// ^
// error: Failure at position 0: not a digit
//

Documentation

Learn more on the ZIO Parser homepage!

Contributing

For the general guidelines, see ZIO contributor's guide.

Code of Conduct

See the Code of Conduct

Support

Come chat with us on Badge-Discord.

License

License