View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0036366 | FPC | Packages | public | 2019-11-27 10:36 | 2019-11-27 10:48 |
Reporter | Thaddy de Koning | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | no change required | ||
Platform | all | OS | all | OS Version | all |
Product Version | 3.3.1 | Product Build | 43592 | ||
Target Version | Fixed in Version | ||||
Summary | 0036366: TfpExtressionParser: bugs in aggregates min, max, sum, avg, count | ||||
Description | TfpExtressionParser is not able to parse the above aggregates correctly | ||||
Steps To Reproduce | {$mode delphi} uses sysutils, fpexprpars,math; var FParser: TFPExpressionParser; begin FParser := TFPExpressionParser.Create(nil); try FParser.Builtins :=[bcStrings,bcDateTime,bcMath,bcBoolean,bcConversion,bcData,bcVaria,bcUser,bcAggregate]; try writeln(8 mod 3); FParser.Expression := '8 mod 3'; // mod works in trunk FParser.Evaluate; writeln(FParser.AsInteger); except On E:EExprParser do writeln(E.Message) else Raise; end; try writeln(min(3,5)); FParser.Expression := 'min(3,5)'; // but this fails FParser.Evaluate; writeln(FParser.AsInteger); except on E:EExprParser do writeln(E.Message) else Raise; end; finally FParser.Free; end; end. | ||||
Additional Information | See discussion here: https://forum.lazarus.freepascal.org/index.php/topic,19627.msg340744.html#msg340744 | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
|
Output of the above is: 2 2 3 Expected ) bracket at position 7, but got , |
|
I do not know what a TfpExtressionParser is but that is obviously that my keyboard not always understands me. ;) TfpExpressionParser |
|
The aggregates are not meant to be used like that. They're meant to be evaluated successively in a series of evaluations, as in SQL: min(myfield). See the test cases for use examples |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-11-27 10:36 | Thaddy de Koning | New Issue | |
2019-11-27 10:37 | Thaddy de Koning | Note Added: 0119523 | |
2019-11-27 10:41 | Thaddy de Koning | Note Added: 0119524 | |
2019-11-27 10:48 | Michael Van Canneyt | Assigned To | => Michael Van Canneyt |
2019-11-27 10:48 | Michael Van Canneyt | Status | new => resolved |
2019-11-27 10:48 | Michael Van Canneyt | Resolution | open => no change required |
2019-11-27 10:48 | Michael Van Canneyt | FPCTarget | => - |
2019-11-27 10:48 | Michael Van Canneyt | Note Added: 0119525 |