-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDemo3.dpr
More file actions
45 lines (37 loc) · 805 Bytes
/
Demo3.dpr
File metadata and controls
45 lines (37 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
program Demo3;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
NewMathParser.Oper in 'NewMathParser.Oper.pas',
NewMathParser in 'NewMathParser.pas';
var
MP : TMathParser;
Error: TError;
begin
try
MP := TMathParser.Create;
try
MP.Expression := 'a + b';
MP.Variables['A'] := function: Double
begin
Result := 3 + 3
end;
MP.Variables['b'] := function: Double
begin
Result := 4
end;
Error := MP.Error;
if Error.IsNoError then
Writeln(MP.ParserResult.ToString)
else
Writeln(Error.ToString);
finally
MP.Free;
end;
Readln;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.