Changeset 48 for branches/DelphiToC/Analyze/UPascalParser.pas
- Timestamp:
- Aug 9, 2010, 1:53:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/Analyze/UPascalParser.pas
r47 r48 49 49 TPascalParser = class(TBaseParser) 50 50 procedure ParseWhileDo(SourceCode: TWhileDo); 51 function ParseExpression(SourceCode: TExpression): TExpression;51 procedure ParseExpression(SourceCode: TExpression); 52 52 procedure ParseUsedModuleList(SourceCode: TUsedModuleList); 53 53 procedure ParseModule(SourceCode: TModule); … … 290 290 { TExpression } 291 291 292 function TPascalParser.ParseExpression(SourceCode: TExpression): TExpression;292 procedure TPascalParser.ParseExpression(SourceCode: TExpression); 293 293 var 294 294 Identifier: string; … … 340 340 end; 341 341 end else begin 342 Method := CommonBlock. Methods.Search(Identifier);342 Method := CommonBlock.Functions.Search(Identifier); 343 343 if Assigned(Method) then begin 344 344 // Referenced method … … 444 444 LoopVariable: TVariable; 445 445 IdentName: string; 446 FunctionName: string; 446 447 begin 447 448 begin … … 465 466 if IsIdentificator(FNextToken) then begin 466 467 if Assigned(SourceCode.Variables.Search(FNextToken)) then begin 468 // Variable assignment 467 469 Result := TAssignment.Create; 468 470 TAssignment(Result).CommonBlock := SourceCode; … … 474 476 ParseExpression(TAssignment(Result).Source); 475 477 end else 476 if Assigned(SourceCode.Methods.Search(FNextToken)) then begin 478 if Assigned(SourceCode.Functions.Search(FNextToken)) then begin 479 // Function call 480 FunctionName := ReadCode; 477 481 Result := TFunctionCall.Create; 478 482 TFunctionCall(Result).CommonBlock := SourceCode; 479 TFunctionCall(Result).FunctionRef := SourceCode.Methods.Search(FNextToken); 480 ReadCode; 481 // ParseMetVariable(TFunctionCall(Result).Target); 483 TFunctionCall(Result).FunctionRef := SourceCode.Functions.Search(FunctionName); 484 if FNextToken = '(' then begin 485 Expect('('); 486 with TFunctionCall(Result) do begin 487 ParameterExpression.Add(TExpression.Create); 488 TExpression(ParameterExpression.Last).CommonBlock := SourceCode; 489 ParseExpression(TExpression(ParameterExpression.Last)); 490 end; 491 Expect(')'); 492 end; 482 493 end else begin 483 494 Result := nil; … … 561 572 ParseTypeList(Types) 562 573 else if FNextToken = 'procedure' then 563 ParseFunctionList( Methods)574 ParseFunctionList(Functions) 564 575 else if FNextToken = 'function' then 565 ParseFunctionList( Methods)576 ParseFunctionList(Functions) 566 577 else begin 567 578 ParseBeginEnd(Code); … … 583 594 Expect('begin'); 584 595 while (FNextToken <> 'end') and (FNextTokenType <> ttEndOfFile) do begin 585 Commands.Add(nil);586 596 NewCommand := ParseCommand(CommonBlock); 587 597 if Assigned(NewCommand) then Commands.Add(NewCommand);
Note:
See TracChangeset
for help on using the changeset viewer.