Changeset 205 for branches/interpreter2/UExecutor.pas
- Timestamp:
- Apr 20, 2020, 1:10:44 AM (5 years ago)
- Location:
- branches/interpreter2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/interpreter2
- Property svn:ignore
-
old new 4 4 interpreter.res 5 5 heaptrclog.trc 6 Generated
-
- Property svn:ignore
-
branches/interpreter2/UExecutor.pas
r203 r205 102 102 procedure ExecuteIfThenElse(Block: TExecutorBlock; IfThenElse: TIfThenElse); 103 103 procedure ExecuteWhileDo(Block: TExecutorBlock; WhileDo: TWhileDo); 104 procedure ExecuteRepeatUntil(Block: TExecutorBlock; RepeatUntil: TRepeatUntil); 104 105 procedure ExecuteForToDo(Block: TExecutorBlock; ForToDo: TForToDo); 105 106 procedure ExecuteBlock(ParentBlock: TExecutorBlock; Block: TBlock); … … 432 433 else if Command is TIfThenElse then ExecuteIfThenElse(Block, TIfThenElse(Command)) 433 434 else if Command is TWhileDo then ExecuteWhileDo(Block, TWhileDo(Command)) 435 else if Command is TRepeatUntil then ExecuteRepeatUntil(Block, TRepeatUntil(Command)) 434 436 else if Command is TForToDo then ExecuteForToDo(Block, TForToDo(Command)) 435 437 else raise Exception.Create('Unsupported command type'); … … 458 460 if not TValueBoolean(Value).Value then Break; 459 461 ExecuteCommand(Block, WhileDo.Command); 462 end else raise Exception.Create('Expected boolean value.'); 463 Value.Free; 464 end; 465 end; 466 467 procedure TExecutor.ExecuteRepeatUntil(Block: TExecutorBlock; 468 RepeatUntil: TRepeatUntil); 469 var 470 Value: TValue; 471 I: Integer; 472 begin 473 while True do begin 474 for I := 0 to RepeatUntil.Commands.Count - 1 do 475 ExecuteCommand(Block, TCommand(RepeatUntil.Commands[I])); 476 Value := ExecuteExpression(Block, RepeatUntil.Expression); 477 if Value is TValueBoolean then begin 478 if TValueBoolean(Value).Value then Break; 460 479 end else raise Exception.Create('Expected boolean value.'); 461 480 Value.Free;
Note:
See TracChangeset
for help on using the changeset viewer.