Git Product home page Git Product logo

Comments (4)

exilon avatar exilon commented on August 26, 2024

Sorry, as you can see in readme, TExpressionParser was created to validate object properties. You need to pass and object as first parameter, and an expression as second param, where each condition can be a property or a property of a property of that object:

 if TExpressionParser.Validate(user,('(Age > 30) AND (Dept.Name = "Financial")') then
  begin
    //do something
  end;

But, if you pass a integer as first param, TExpression replaces first part of every condition with that integer.

 TExpressionParser.Validate(20,('(a > 30) AND (a < 40)') //will be transformed as (20 > 30) AND (20 < 40)
 TExpressionParser.Validate(5,('(8,3 > 2) AND (50 < 40)') //will be transformed as (5 > 2) AND (5 < 40)

However, I updated Expressions to support Validate without first param:
``
TExpressionParser.Validate(''(8 > 3) or ((5 > 4) and (2 = 1))')

Priority in TExpressions are defined with parenthesis. Expressions are processed from outer to inner parenthesis and from left to right. See new sample in QuickLib\samples\delphi.

from quicklib.

Midas-Li avatar Midas-Li commented on August 26, 2024

Thanks for your guidance.
In fact, I also made a similar module, it can also do expression evaluation, and without the need for logical expressions with parentheses and the operator and support addition, subtraction, multiplication and division operations, do you have any plans to expand your current module?
If you are interested, I can send it to you for reference.

from quicklib.

exilon avatar exilon commented on August 26, 2024

Yes, of course.

from quicklib.

Midas-Li avatar Midas-Li commented on August 26, 2024

Attached is the file, please receive it.
Calc.zip

from quicklib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.