SyntaxParser.Core
2.1.6
See the version list below for details.
dotnet add package SyntaxParser.Core --version 2.1.6
NuGet\Install-Package SyntaxParser.Core -Version 2.1.6
<PackageReference Include="SyntaxParser.Core" Version="2.1.6" />
paket add SyntaxParser.Core --version 2.1.6
#r "nuget: SyntaxParser.Core, 2.1.6"
// Install SyntaxParser.Core as a Cake Addin #addin nuget:?package=SyntaxParser.Core&version=2.1.6 // Install SyntaxParser.Core as a Cake Tool #tool nuget:?package=SyntaxParser.Core&version=2.1.6
SyntaxParser
For those whom want to parse business understandable, and easy to read commands in to an C# instance.
Not intended to replace JSON or other data structures for external oriented production software. Use it to speed up project Initialization, produce data and workflow inline with the business.
Usage
Decorate a class with the SyntaxAttribute.
[Syntax($"{nameof(From)}=>{nameof(To)}")]
public class Example
{
public string From { get; set; }
public string To { get; set; }
}
Parse file or text to instances.
var result = SyntaxParser.ParseText<Example>("Rome=>Paris");
// result will be an instance with the following values.
// {
// "From" : "Rome",
// "To" : "Paris"
// }
Parse file or text to json.
var result = SyntaxParser.ParseTextToJson<Example>("Rome=>Paris");
// result will be an instance with the following values.
// {
// "From" : "Rome",
// "To" : "Paris"
// }
Test your syntax
https://regex101.com/r/tCpfu5/1
Benchmarks
Methods with the name JsonConverter{dataOrigin} are Newtonsoft equivalant of the Parse{dataOrigin}. NewtonSofts converter is added to the benchmarks for reference. For all methods two tests are run. One small with 4 instructions and one Large with 1344 instructions.
Method | FilePath | Mean | Error | StdDev | Gen 0 | Gen 1 | Allocated |
---|---|---|---|---|---|---|---|
ParseText | ./instructions-small | 1.411 μs | 0.0281 μs | 0.0491 μs | 0.1774 | - | 560 B |
JsonConverterText | ./instructions-small | 4.308 μs | 0.0856 μs | 0.1407 μs | 0.2747 | - | 872 B |
ParseFile | ./instructions-small | 128.964 μs | 2.1252 μs | 3.7222 μs | 2.6855 | 1.2207 | 8,864 B |
JsonConverterFile | ./instructions-small | 130.865 μs | 2.4706 μs | 2.4265 μs | 1.4648 | 0.7324 | 4,777 B |
JsonConverterAsyncFile | ./instructions-small | 210.986 μs | 4.1293 μs | 5.6522 μs | 1.7090 | 0.7324 | 5,840 B |
ParseAsyncFile | ./instructions-small | 214.532 μs | 4.2618 μs | 8.2110 μs | 3.4180 | 1.7090 | 11,022 B |
ParseText | ./instructions-large | 440.304 μs | 8.5135 μs | 13.2545 μs | 44.4336 | - | 139,920 B |
ParseFile | ./instructions-large | 565.516 μs | 3.4166 μs | 2.8530 μs | 56.6406 | 15.6250 | 180,835 B |
JsonConverterText | ./instructions-large | 1,175.027 μs | 16.2552 μs | 15.2051 μs | 46.8750 | 3.9063 | 151,713 B |
ParseAsyncFile | ./instructions-large | 1,287.300 μs | 10.6269 μs | 9.4205 μs | 164.0625 | 31.2500 | 517,287 B |
JsonConverterFile | ./instructions-large | 1,537.124 μs | 30.0269 μs | 54.9059 μs | 48.8281 | 1.9531 | 155,617 B |
JsonConverterAsyncFile | ./instructions-large | 1,775.679 μs | 32.2867 μs | 48.3253 μs | 46.8750 | 7.8125 | 157,283 B |
TODO
- Nested Support
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
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
2.2.3 | 347 | 11/17/2022 | |
2.2.0 | 377 | 10/27/2022 | |
2.1.6 | 459 | 9/27/2022 | |
2.1.4 | 413 | 9/27/2022 | |
2.1.2 | 429 | 9/27/2022 | |
2.1.0 | 446 | 9/27/2022 | |
2.0.0 | 443 | 9/27/2022 | |
1.0.1-alpha3 | 234 | 4/15/2022 | |
1.0.1-alpha2 | 226 | 4/14/2022 | |
0.1.32 | 489 | 9/27/2022 |