Changeset 5 for trunk/Compiler/Produce
- Timestamp:
- Nov 5, 2010, 9:36:20 AM (14 years ago)
- Location:
- trunk/Compiler/Produce
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Produce/UProducerDynamicC.pas
r2 r5 274 274 function TProducerDynamicC.GenerateExpression(Expression: TExpression): string; 275 275 begin 276 case Expression.NodeType of 277 ntConstant: begin 278 if VarType(Expression.Value) = varString then 279 Result := '"' + Expression.Value + '"' 280 else Result := Expression.Value; 281 end; 282 ntVariable: Result := Expression.Variable.Name; 283 ntFunction: Result := Expression.FunctionCall.Name; 284 ntOperator: begin 285 Result := GenerateExpression(TExpression(Expression.SubItems.First)) 286 + ' ' + TranslateOperator(Expression.OperatorName) + ' ' + 287 GenerateExpression(TExpression(Expression.SubItems.Last)); 288 end; 289 ntNone: ; 276 if Assigned(Expression) then begin 277 case Expression.NodeType of 278 ntConstant: begin 279 Result := Expression.Constant.Name; 280 end; 281 ntValue: begin 282 if VarType(Expression.Value) = varString then 283 Result := '"' + Expression.Value + '"' 284 else Result := Expression.Value; 285 end; 286 ntVariable: Result := Expression.Variable.Name; 287 ntFunction: Result := Expression.FunctionCall.Name; 288 ntOperator: begin 289 Result := GenerateExpression(TExpression(Expression.SubItems.First)) 290 + ' ' + TranslateOperator(Expression.OperatorName) + ' ' + 291 GenerateExpression(TExpression(Expression.SubItems.Last)); 292 end; 293 ntNone: ; 294 end; 295 if Expression.Braces then Result := '(' + Result + ')'; 290 296 end; 291 297 end; -
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.