Pevac 0.5.1
dotnet add package Pevac --version 0.5.1
NuGet\Install-Package Pevac -Version 0.5.1
<PackageReference Include="Pevac" Version="0.5.1" />
paket add Pevac --version 0.5.1
#r "nuget: Pevac, 0.5.1"
// Install Pevac as a Cake Addin #addin nuget:?package=Pevac&version=0.5.1 // Install Pevac as a Cake Tool #tool nuget:?package=Pevac&version=0.5.1
Pevac
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
Product | Versions 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. |
-
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.
This is a prerelease version