delegateas / ExpressionEngine

Expression Engine for Power Automate expressions written in C# using Sprache!
MIT License
8 stars 3 forks source link

Can not parse expression #94

Closed yejinmo closed 1 year ago

yejinmo commented 1 year ago

Description

No matter how the expression is written, it will output as it is

Reproduction Steps

Using Visual Studio 2022 create ASP.NET Core Web / .Net 6.0 and install Delegate.ExpressionEngine 4.1.2

Code :

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
var services = new ServiceCollection();
services.AddExpressionEngine();
var sp = services.BuildServiceProvider();
var ee = sp.GetRequiredService<IExpressionEngine>();
var str = ee.Parse("1 + 1").Result;
Console.WriteLine(str); // output "1 + 1"
app.Run();

Expected behavior

2

Actual behavior

1 + 1

Configuration

Other information

The .csproj is :

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Delegate.ExpressionEngine" Version="4.1.2" />
  </ItemGroup>

</Project>
thygesteffensen commented 1 year ago

Hello there,

1 + 1 is not a valid expression, to add two numbers it should be add(1, 1).

The expression language is taken from Power Automate, so you can look here for more documentation :) https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference