Changeset 98 for branches/interpreter/Execute3.pas
- Timestamp:
- Feb 3, 2017, 10:48:19 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/interpreter/Execute3.pas
r97 r98 21 21 end; 22 22 23 function ExecuteExpression (Expression: PExpression): Boolean;23 function ExecuteExpressionBoolean(Expression: PExpression): Boolean; 24 24 begin 25 25 … … 28 28 procedure ExecuteWhileDo(WhileDo: PWhileDo); 29 29 begin 30 if ExecuteExpression(@WhileDo^.Condition) then30 while ExecuteExpressionBoolean(@WhileDo^.Condition) do 31 31 ExecuteCommand(@WhileDo^.Command); 32 32 end; … … 34 34 procedure ExecuteIfThenElse(IfThenElse: PIfThenElse); 35 35 begin 36 if ExecuteExpression (@IfThenElse^.Condition) then36 if ExecuteExpressionBoolean(@IfThenElse^.Condition) then 37 37 ExecuteCommand(@IfThenElse^.DoThen) 38 38 else ExecuteCommand(@IfThenElse^.DoElse); … … 40 40 41 41 procedure ExecuteExecution(Execution: PExecution); 42 var 43 I: Integer; 42 44 begin 43 // Set parameters 45 { Execution^.Func^.Variables.Add(VariableCreate('Result', Execution^.Func^.ReturnType)); 46 for I := 0 to Length(Execution^.Func^.Parameters.Items) - 1 do begin 47 Execution^.Func^.Variables.Add(VariableCreate(Execution^.Func^.Parameters.Items[I].Name, 48 Execution^.Func^.Parameters.Items[I].DataType)); 49 case Assignment^.Destination^.DataType^.BaseType of 50 Execution^.Func^.Variables.Items[Length(Execution^.Func^.Variables.Items) - 1].V 51 end; 52 end; 53 } 44 54 ExecuteBeginEnd(@Execution^.Func^.BeginEnd); 45 55 end; … … 47 57 procedure ExecuteAssignment(Assignment: PAssignment); 48 58 begin 49 59 case Assignment^.Destination^.DataType^.BaseType of 60 btBoolean: Assignment^.Destination.ValueBoolean := ExecuteExpressionBoolean(@Assignment^.Source); 61 //btChar: Assignment^.Destination.ValueBoolean := ExecuteExpressionChar(@Assignment^.Source); 62 //btString: Assignment^.Destination.ValueBoolean := ExecuteExpressionString(@Assignment^.Source); 63 //btInteger: Assignment^.Destination.ValueBoolean := ExecuteExpressionInteger(@Assignment^.Source); 64 end; 50 65 end; 51 66
Note:
See TracChangeset
for help on using the changeset viewer.