dynamicexpresso / DynamicExpresso

C# expressions interpreter
http://dynamic-expresso.azurewebsites.net/
MIT License
2.02k stars 379 forks source link

DetectIdentifiers parsing decimals with suffix are considered as Identifier #300

Closed tyl24 closed 3 months ago

tyl24 commented 10 months ago

Hello, In the DetectIdentifiers method an expression like this one : "amount=Math.Round(455.7 * (0.2m/1000))" considere that the decimal suffix m is an unknownIdentifier, which is wrong ! This behaviours was not the case in previous version 2.13.

In file Detector.cs, I propose to change the RegEx :IdentifiersDetectionRegex like this : (?<id>@?(?<!\d)(?<!\dm)(?<!\df)(?<!\dd)[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)

davideicardi commented 10 months ago

Thank you! If you are able to create a PR I can merge it. Otherwise I will do it.