Changeset 146 for branches/easy compiler/USourceGenerator.pas
- Timestamp:
- Jan 17, 2018, 2:25:45 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/easy compiler/USourceGenerator.pas
r145 r146 14 14 private 15 15 Indent: Integer; 16 function GenerateBeginEnd(BeginEnd: T SourceBeginEnd): string;16 function GenerateBeginEnd(BeginEnd: TCommandBeginEnd): string; 17 17 function IndentStr: string; 18 18 public … … 49 49 end; 50 50 51 function TSourceGenerator.GenerateBeginEnd(BeginEnd: T SourceBeginEnd): string;51 function TSourceGenerator.GenerateBeginEnd(BeginEnd: TCommandBeginEnd): string; 52 52 var 53 Instruction: TSource Instruction;53 Instruction: TSourceCommand; 54 54 I: Integer; 55 55 Value: TSourceValue; … … 77 77 with BeginEnd do 78 78 for I := 0 to Instructions.Count - 1 do begin 79 Instruction := TSource Instruction(Instructions[I]);80 if Instruction is T SourceFunctionCall then81 with T SourceFunctionCall(Instruction) do begin79 Instruction := TSourceCommand(Instructions[I]); 80 if Instruction is TCommandFunctionCall then 81 with TCommandFunctionCall(Instruction) do begin 82 82 if Name = 'print' then begin 83 83 Result := Result + IndentStr + 'Write(' + GenerateRef(TSourceReference(Parameters[0])) + ');' + … … 101 101 raise Exception.Create('Unsupported instruction name.'); 102 102 end else 103 if Instruction is T SourceBeginEnd then begin104 Result := Result + GenerateBeginEnd(T SourceBeginEnd(Instruction)) +103 if Instruction is TCommandBeginEnd then begin 104 Result := Result + GenerateBeginEnd(TCommandBeginEnd(Instruction)) + 105 105 ';' + LineEnding; 106 end else 107 if Instruction is TCommandIfZero then begin 108 Result := Result + IndentStr + 'if ' + TCommandIfZero(Instruction).Variable.Name + ' = 0 then '; 106 109 end else 107 110 raise Exception.Create('Unsupported instruction');
Note:
See TracChangeset
for help on using the changeset viewer.