Pevac 0.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Pevac --version 0.5.0                
NuGet\Install-Package Pevac -Version 0.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pevac" Version="0.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pevac --version 0.5.0                
#r "nuget: Pevac, 0.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Pevac as a Cake Addin
#addin nuget:?package=Pevac&version=0.5.0

// Install Pevac as a Cake Tool
#tool nuget:?package=Pevac&version=0.5.0                

Pevac Some other name that doesn't matter

Pevac is a simple, lightweight library for constructing functional, forward only parsers that use Utf8JsonReader struct as the source of tokens. Parsers can then be used to simplify constuction of custom deserializers for the System.Text.Json.

It is heavely inspired by the Sprache parser combinator library!

Motivation

The scope of the project is to simplify building cusom deserializers for the System.Text.Json by providing the posibility of building functional parsers that can consume an instance of Utf8JsonReader struct.

It is impossible to use the Utf8JsonReader with any existing parser combinator library because of the limitation imposed on the struct.

  • Utf8JsonReader cannot be specified as a generic parameter.
  • All the interaction with the Utf8JsonReader struct should be through a reference.

Usage

Unlike most parser-building frameworks, you use Pevac directly from your program code, and don't need to set up any build-time code generation tasks. Pevac itself is a single tiny assembly.

Pevac provides a number of build-in functions that can make bigger parsers from smaller once, often callable via Linq query comprehensions:

Parser<Foo> parser = from _ in Parser.StartObject
                     from propertyName in Parser.PropertyName
                     from value in Parser.String
                     from __ in Parser.EndObject
                     select new Foo(propertyName, value)

var json = "{ \"foo\" : \"bar\" }";
var bytes = Encoding.UTF8.GetBytes(foo);
var reader = new Utf8JsonReader(bytes);
var foo = parser.Parse(reader, default);

Assert.AreEqual(new Foo("foo", "bar"), foo);

Credits

alternate text is missing from this package README image

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Pevac:

Package Downloads
Notion.Sharp

An unnoficial sdk for the Notion REST Api

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.1 770 10/23/2021
0.5.0 338 10/18/2021
0.4.0 414 10/14/2021
0.3.4 333 10/13/2021
0.3.3 339 10/10/2021
0.3.2 346 10/10/2021
0.3.1 524 10/1/2021
0.3.0 315 9/27/2021
0.2.0 301 9/19/2021

This is a prerelease version