Changeset 142 for branches/easy compiler/USourceExecutor.pas
- Timestamp:
- Jan 16, 2018, 3:19:23 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/easy compiler/USourceExecutor.pas
r141 r142 28 28 FOnOutput: TOutputEvent; 29 29 Variables: TExecutorVariables; 30 procedure ExecuteBeginEnd(BeginEnd: TSourceBeginEnd); 30 31 public 31 32 constructor Create; … … 68 69 69 70 procedure TSourceExecutor.Execute(SourceCode: TSourceCode); 71 begin 72 ExecuteBeginEnd(SourceCode.Main); 73 end; 74 75 procedure TSourceExecutor.ExecuteBeginEnd(BeginEnd: TSourceBeginEnd); 70 76 var 71 77 IP: Integer; … … 96 102 begin 97 103 IP := 0; 98 while IP < SourceCode.Instructions.Count do begin99 Instruction := TSourceInstruction( SourceCode.Instructions[IP]);100 if Instruction is TSource InstructionFunctionthen101 with TSource InstructionFunction(Instruction) do begin104 while IP < BeginEnd.Instructions.Count do begin 105 Instruction := TSourceInstruction(BeginEnd.Instructions[IP]); 106 if Instruction is TSourceFunctionCall then 107 with TSourceFunctionCall(Instruction) do begin 102 108 if Name = 'print' then begin 103 109 if Assigned(FOnOutput) then begin … … 156 162 else raise Exception.Create('Wrong type for increment'); 157 163 end else 158 raise Exception.Create('Unsupported function: ' + TSourceInstructionFunction(Instruction).Name); 159 end else raise Exception.Create('Unsupported instruction'); 164 raise Exception.Create('Unsupported function: ' + TSourceFunctionCall(Instruction).Name); 165 end else 166 if Instruction is TSourceBeginEnd then begin 167 ExecuteBeginEnd(TSourceBeginEnd(Instruction)); 168 end else 169 raise Exception.Create('Unsupported instruction'); 160 170 Inc(IP); 161 171 end;
Note:
See TracChangeset
for help on using the changeset viewer.