JsepSharp 1.3.8.1

dotnet add package JsepSharp --version 1.3.8.1
NuGet\Install-Package JsepSharp -Version 1.3.8.1
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="JsepSharp" Version="1.3.8.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JsepSharp --version 1.3.8.1
#r "nuget: JsepSharp, 1.3.8.1"
#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 JsepSharp as a Cake Addin
#addin nuget:?package=JsepSharp&version=1.3.8.1

// Install JsepSharp as a Cake Tool
#tool nuget:?package=JsepSharp&version=1.3.8.1

JsepSharp

This library is designed to parse expressions but not operations. The difference between expressions and operations is akin to the difference between a cell in an Excel spreadsheet vs. a proper JavaScript program. In other words, there is no support for constructs like if, while, try, function, class, etc.

This is a C# .NET Core conversion of the jsep project, which is a simple expression parser written in JavaScript.

Can I Run Parsed Expressions?

This library just just a parser. It does not attempt to execute or compile the parsed AST (abstract syntax tree).

Usage

// Create instance to use
var j = new Jsep("a + 2");
j.Parse();

// Use static parse
Jsep.Parse("a + 2");
Custom Operators

Methods are available to add, remove, and reset custom unary and binary operators.

// Add and remove a left-associative spaceship / comparison operator with same precedence (7) as other comparisons (<, >, <=, >=).
Jsep.AddBinaryOp("<=>", 7, false);
Jsep.RemoveBinaryOp("<=>");

// Add and remove a bit inversion operator.
Jsep.AddUnaryOp("~");
Jsep.RemoveUnaryOp("~");

// Reset all operators to defaults / built-ins.
Jsep.ResetBinaryOps();
Jsep.ResetUnaryOps();
Custom Identifiers

Methods are available to add, remove, and reset custom identifier characters.

// Add/remove ability for identifiers to contain the @ symbol.
Jsep.AddIdentifier('@');
Jsep.RemoveIdentifier('@');

// Reset back to defaults.
Jsep.ResetIdentifiers();
Custom Literals

Methods are available to add, remove, and reset custom literal transformations. These are used to convert keywords into raw literals (e.g. "true" becoming a boolean true):

// Add/remove nil alias for null.
Jsep.AddLiteral("nil", null);
Jsep.RemoveLiteral("nil");

// Reset back to defaults.
Jsep.ResetLiterals();

License

JsepSharp is a derivative work under the MIT license. See LICENSE file.

Thanks

To all the contributors of the original jsep project.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 is compatible.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on JsepSharp:

Package Downloads
JsepSharp.Plugins

Standard Optional Plugins for the JsepSharp JavaScript Expression Parser.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.8.1 105 4/10/2024
1.3.8 187 3/11/2024