Changeset 5 for trunk/Compiler/Produce/UProducerPascal.pas
- Timestamp:
- Nov 5, 2010, 9:36:20 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Produce/UProducerPascal.pas
r2 r5 309 309 function TProducerPascal.GenerateExpression(Expression: TExpression): string; 310 310 begin 311 case Expression.NodeType of 312 ntConstant: Result := Expression.Value; 313 ntVariable: Result := Expression.Variable.Name; 314 ntFunction: Result := Expression.FunctionCall.Name; 315 ntOperator: begin 316 Result := GenerateExpression(TExpression(Expression.SubItems.First)) 317 + ' ' + Expression.OperatorName + ' ' + 318 GenerateExpression(TExpression(Expression.SubItems.Last)); 319 end; 320 ntNone: ; 311 if Assigned(Expression) then begin 312 case Expression.NodeType of 313 ntConstant: begin 314 Result := Expression.Constant.Name; 315 end; 316 ntValue: begin 317 if VarType(Expression.Value) = varString then 318 Result := '''' + Expression.Value + '''' 319 else Result := Expression.Value; 320 end; 321 ntVariable: Result := Expression.Variable.Name; 322 ntFunction: Result := Expression.FunctionCall.Name; 323 ntOperator: begin 324 Result := GenerateExpression(TExpression(Expression.SubItems.First)) 325 + ' ' + Expression.OperatorName + ' ' + 326 GenerateExpression(TExpression(Expression.SubItems.Last)); 327 end; 328 ntNone: ; 329 end; 330 if Expression.Braces then Result := '(' + Result + ')'; 321 331 end; 322 332 end;
Note:
See TracChangeset
for help on using the changeset viewer.