Comments (4)
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.
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.
Yes, of course.
from quicklib.
Attached is the file, please receive it.
Calc.zip
from quicklib.
Related Issues (20)
- Create a generic object memory cache that does not serialize the objects
- Quick.Files.pas(1464,63) Error: identifier idents no member "FindData"
- TLightweightEvent is not available, FPC can not be used for quicklib.Threads HOT 3
- Non-Visual Control for Quicklib (suggestion)
- Quick.Arrays.Helper.pas(99,3) Error: Identifier not found "TArrayUtil"
- Access violation destroying TIocContainer HOT 1
- Know how many tasks are active
- Logical error HOT 1
- samples RestServer does not work
- YAML parser does not support escape sequences (e.g. "\u0000")
- QuickLib does not compile in Lazarus 224 / Fpc 322
- Use dependency manager - Boss
- QuickLib / Log etc - Embarcadero GetIt HOT 2
- Automapper copy object reference instead of content HOT 1
- Improvement Request: Add support to TValue type converters present in Spring.ValueConverters HOT 1
- Android Back Ground Service TScheduledTasks not working HOT 1
- Hope Function Operators Support for TList HOT 2
- FPC3.3.1 compiler ERROR
- GetLoggedUserName returns empty string on WSL (include possible fix) HOT 2
- Quick.Logger.Intf.pas generates 11 E2266 build errors on the overload
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quicklib.