Changeset 222 for branches/interpreter2/Generators/UGeneratorPascal.pas
- Timestamp:
- Nov 25, 2020, 12:18:45 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/interpreter2/Generators/UGeneratorPascal.pas
r221 r222 31 31 procedure GenerateExpressionOperation(Block: TBlock; Expression: TExpressionOperation); 32 32 procedure GenerateExpressionOperand(Block: TBlock; Expression: TExpressionOperand); 33 procedure GenerateExpressionBrackets(Block: TBlock; Expression: TExpressionBrackets); 33 34 procedure GenerateBreak(Block: TBlock; BreakCmd: TBreak); 34 35 procedure GenerateContinue(Block: TBlock; ContinueCmd: TContinue); 35 36 procedure GenerateValue(Value: TValue); 36 37 public 37 Prog: TProgram;38 38 procedure Generate; override; 39 constructor Create; override; 39 40 end; 40 41 … … 134 135 if Expression is TExpressionOperand then 135 136 GenerateExpressionOperand(Block, TExpressionOperand(Expression)) 137 else 138 if Expression is TExpressionBrackets then 139 GenerateExpressionBrackets(Block, TExpressionBrackets(Expression)) 136 140 else raise Exception.Create('Unknown expression class.'); 137 141 end; … … 145 149 if I > 0 then begin 146 150 AddText(' '); 147 if Expression.Operation = eoAdd then AddText('+') 148 else if Expression.Operation = eoSub then AddText('-') 149 else if Expression.Operation = eoEqual then AddText('=') 150 else if Expression.Operation = eoNotEqual then AddText('<>'); 151 AddText(ExpressionOperatorText[Expression.Operation]); 151 152 AddText(' '); 152 153 end; … … 165 166 else raise Exception.Create('Unsupported exception operand type.'); 166 167 end; 168 end; 169 170 procedure TGeneratorPascal.GenerateExpressionBrackets(Block: TBlock; 171 Expression: TExpressionBrackets); 172 begin 173 AddText('('); 174 GenerateExpression(Block, Expression.Expression); 175 AddText(')'); 167 176 end; 168 177 … … 313 322 end; 314 323 324 constructor TGeneratorPascal.Create; 325 begin 326 inherited; 327 Name := 'Pascal'; 328 FileExt := '.pas'; 329 end; 330 315 331 end. 316 332
Note:
See TracChangeset
for help on using the changeset viewer.