- Timestamp:
- Nov 9, 2010, 12:21:56 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Analyze/UAnalyzer.pas
r12 r20 29 29 end; 30 30 31 TGetSourceEvent = function (Name: string; Source: TStringList): Boolean of object;31 TGetSourceEvent = function (Name: string; var SourceCode: string): Boolean of object; 32 32 33 33 { TAnalyzer } … … 51 51 CodeStreamPosition: Integer; 52 52 CodePosition: TPoint; 53 SourceCode Text: TStringList;53 SourceCode: string; 54 54 Tokens: TObjectList; // TObjectList<TToken> 55 55 TokenIndex: Integer; … … 225 225 Tokens.Clear; 226 226 TokenIndex := 0; 227 while CodeStreamPosition < Length(SourceCode Text.Text) do begin227 while CodeStreamPosition < Length(SourceCode) do begin 228 228 NewToken := TToken.Create; 229 229 GetNextToken; … … 255 255 FNextTokenType := ttNone; 256 256 FParserState := psNone; 257 with SourceCodeText do 257 258 258 while True do begin 259 if CodeStreamPosition < Length( Text) then begin260 CurrentChar := Text[CodeStreamPosition];259 if CodeStreamPosition < Length(SourceCode) then begin 260 CurrentChar := SourceCode[CodeStreamPosition]; 261 261 end else begin 262 262 FNextToken := ''; -
trunk/Compiler/Analyze/UAnalyzerPascal.pas
r19 r20 91 91 try 92 92 Parser := TAnalyzerPascal.Create; 93 Parser.SourceCodeText := TStringList.Create;94 93 Parser.OnDebugLog := OnDebugLog; 95 94 Parser.ProgramCode := ProgramCode; 96 95 Parser.OnGetSource := OnGetSource; 97 96 if Assigned(OnGetSource) then begin 98 if OnGetSource(Name, Parser.SourceCode Text) then begin97 if OnGetSource(Name, Parser.SourceCode) then begin 99 98 Parser.Process; 100 99 Parser.FileName := Name; … … 107 106 end else Result := False; 108 107 finally 109 Parser.SourceCodeText.Free;110 108 Parser.Free; 111 109 end; … … 560 558 NewType: TType; 561 559 begin 560 Log('ParseCommonBlockInterface'); 562 561 with SourceCode do begin 563 562 while (NextToken <> 'implementation') and (NextTokenType <> ttEndOfFile) do begin -
trunk/Compiler/UCompiler.pas
r16 r20 71 71 ProducedCode := TStringList.Create; 72 72 Analyzer.FileName := ModuleName; 73 Analyzer.SourceCode Text := Source;73 Analyzer.SourceCode := Source.Text; 74 74 Analyzer.Process; 75 75 //ShowMessage(IntToHex(Integer(Addr(Analyzer.OnGetSource)), 8)); -
trunk/IDE/Forms/UMainForm.pas
r14 r20 73 73 Project: TProject; 74 74 Compiler: TCompiler; 75 function GetSource(Name: string; Source: TStringList): Boolean;75 function GetSource(Name: string; var SourceCode: string): Boolean; 76 76 end; 77 77 … … 112 112 end; 113 113 114 function TMainForm.GetSource(Name: string; Source: TStringList): Boolean;114 function TMainForm.GetSource(Name: string; var SourceCode: string): Boolean; 115 115 var 116 116 FileName: string; 117 F: TFileStream; 117 118 begin 118 119 FileName := Project.GetDir(True) + Name + '.pas'; 119 if FileExists(FileName) then begin 120 Source.LoadFromFile(FileName); 120 if FileExists(FileName) then 121 try 122 F := TFileStream.Create(FileName, fmOpenRead); 123 SetLength(SourceCode, F.Size); 124 if F.Size > 0 then 125 F.Read(SourceCode[1], F.Size); 121 126 Result := True; 127 finally 128 F.Free; 122 129 end else Result := False; 123 130 end; -
trunk/IDE/Transpascal.lpi
r19 r20 53 53 </Item5> 54 54 </RequiredPackages> 55 <Units Count="6 3">55 <Units Count="65"> 56 56 <Unit0> 57 57 <Filename Value="Transpascal.lpr"/> … … 71 71 <ResourceBaseClass Value="Form"/> 72 72 <UnitName Value="UMainForm"/> 73 <IsVisibleTab Value="True"/> 73 74 <EditorIndex Value="0"/> 74 75 <WindowIndex Value="0"/> 75 <TopLine Value=" 93"/>76 <CursorPos X=" 21" Y="107"/>76 <TopLine Value="114"/> 77 <CursorPos X="48" Y="114"/> 77 78 <UsageCount Value="215"/> 78 79 <Loaded Value="True"/> … … 469 470 <EditorIndex Value="2"/> 470 471 <WindowIndex Value="0"/> 471 <TopLine Value="6 3"/>472 <CursorPos X="1 9" Y="79"/>473 <UsageCount Value="3 4"/>472 <TopLine Value="60"/> 473 <CursorPos X="1" Y="76"/> 474 <UsageCount Value="35"/> 474 475 <Loaded Value="True"/> 475 476 </Unit46> … … 487 488 <EditorIndex Value="3"/> 488 489 <WindowIndex Value="0"/> 489 <TopLine Value=" 22"/>490 <CursorPos X=" 14" Y="77"/>491 <UsageCount Value="3 3"/>490 <TopLine Value="66"/> 491 <CursorPos X="37" Y="79"/> 492 <UsageCount Value="34"/> 492 493 <Loaded Value="True"/> 493 494 </Unit48> … … 495 496 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 496 497 <UnitName Value="UAnalyzerPascal"/> 497 <IsVisibleTab Value="True"/> 498 <EditorIndex Value="6"/> 499 <WindowIndex Value="0"/> 500 <TopLine Value="517"/> 501 <CursorPos X="1" Y="530"/> 502 <UsageCount Value="33"/> 498 <EditorIndex Value="8"/> 499 <WindowIndex Value="0"/> 500 <TopLine Value="95"/> 501 <CursorPos X="1" Y="108"/> 502 <UsageCount Value="34"/> 503 503 <Loaded Value="True"/> 504 504 </Unit49> … … 506 506 <Filename Value="..\Compiler\Produce\UProducerPascal.pas"/> 507 507 <UnitName Value="UProducerPascal"/> 508 <EditorIndex Value=" 4"/>508 <EditorIndex Value="6"/> 509 509 <WindowIndex Value="0"/> 510 510 <TopLine Value="267"/> 511 511 <CursorPos X="14" Y="270"/> 512 <UsageCount Value="3 3"/>512 <UsageCount Value="34"/> 513 513 <Loaded Value="True"/> 514 514 </Unit50> … … 540 540 <Filename Value="..\Compiler\USourceCode.pas"/> 541 541 <UnitName Value="USourceCode"/> 542 <EditorIndex Value=" 5"/>542 <EditorIndex Value="7"/> 543 543 <WindowIndex Value="0"/> 544 544 <TopLine Value="707"/> 545 545 <CursorPos X="3" Y="711"/> 546 <UsageCount Value="3 3"/>546 <UsageCount Value="34"/> 547 547 <Loaded Value="True"/> 548 548 </Unit54> … … 609 609 <UsageCount Value="12"/> 610 610 </Unit62> 611 <Unit63> 612 <Filename Value="E:\Programy\Lazarus\fpc\2.4.3\source\rtl\objpas\classes\classesh.inc"/> 613 <EditorIndex Value="4"/> 614 <WindowIndex Value="0"/> 615 <TopLine Value="625"/> 616 <CursorPos X="36" Y="638"/> 617 <UsageCount Value="11"/> 618 <Loaded Value="True"/> 619 </Unit63> 620 <Unit64> 621 <Filename Value="E:\Programy\Lazarus\fpc\2.4.3\source\rtl\objpas\classes\stringl.inc"/> 622 <EditorIndex Value="5"/> 623 <WindowIndex Value="0"/> 624 <TopLine Value="428"/> 625 <CursorPos X="3" Y="441"/> 626 <UsageCount Value="11"/> 627 <Loaded Value="True"/> 628 </Unit64> 611 629 </Units> 612 <JumpHistory Count=" 30" HistoryIndex="29">630 <JumpHistory Count="29" HistoryIndex="28"> 613 631 <Position1> 614 632 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 615 <Caret Line=" 1072" Column="1" TopLine="1053"/>633 <Caret Line="537" Column="1" TopLine="519"/> 616 634 </Position1> 617 635 <Position2> 618 <Filename Value="..\Compiler\ Produce\UProducerPascal.pas"/>619 <Caret Line=" 438" Column="23" TopLine="416"/>636 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 637 <Caret Line="546" Column="1" TopLine="536"/> 620 638 </Position2> 621 639 <Position3> 622 640 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 623 <Caret Line=" 41" Column="65" TopLine="27"/>641 <Caret Line="550" Column="47" TopLine="540"/> 624 642 </Position3> 625 643 <Position4> 626 644 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 627 <Caret Line=" 3" Column="61" TopLine="1"/>645 <Caret Line="442" Column="27" TopLine="434"/> 628 646 </Position4> 629 647 <Position5> 630 648 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 631 <Caret Line="4 0" Column="31" TopLine="27"/>649 <Caret Line="488" Column="21" TopLine="481"/> 632 650 </Position5> 633 651 <Position6> 634 652 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 635 <Caret Line=" 626" Column="39" TopLine="623"/>653 <Caret Line="562" Column="4" TopLine="548"/> 636 654 </Position6> 637 655 <Position7> 638 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>639 <Caret Line=" 576" Column="27" TopLine="563"/>656 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 657 <Caret Line="260" Column="26" TopLine="243"/> 640 658 </Position7> 641 659 <Position8> 642 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>643 <Caret Line=" 1191" Column="19" TopLine="1178"/>660 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 661 <Caret Line="257" Column="19" TopLine="243"/> 644 662 </Position8> 645 663 <Position9> 646 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>647 <Caret Line=" 714" Column="34" TopLine="695"/>664 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 665 <Caret Line="53" Column="27" TopLine="40"/> 648 666 </Position9> 649 667 <Position10> 650 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>651 <Caret Line=" 531" Column="42" TopLine="512"/>668 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 669 <Caret Line="227" Column="51" TopLine="214"/> 652 670 </Position10> 653 671 <Position11> 654 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>655 <Caret Line=" 530" Column="44" TopLine="520"/>672 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 673 <Caret Line="257" Column="3" TopLine="244"/> 656 674 </Position11> 657 675 <Position12> 658 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>659 <Caret Line=" 533" Column="11" TopLine="520"/>676 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 677 <Caret Line="259" Column="48" TopLine="246"/> 660 678 </Position12> 661 679 <Position13> 662 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>663 <Caret Line=" 531" Column="26" TopLine="514"/>680 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 681 <Caret Line="254" Column="3" TopLine="243"/> 664 682 </Position13> 665 683 <Position14> 666 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>667 <Caret Line="53 2" Column="17" TopLine="514"/>684 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 685 <Caret Line="53" Column="5" TopLine="30"/> 668 686 </Position14> 669 687 <Position15> 670 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>671 <Caret Line=" 530" Column="1" TopLine="514"/>688 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 689 <Caret Line="229" Column="47" TopLine="214"/> 672 690 </Position15> 673 691 <Position16> 674 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>675 <Caret Line=" 531" Column="1" TopLine="514"/>692 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 693 <Caret Line="259" Column="48" TopLine="246"/> 676 694 </Position16> 677 695 <Position17> 678 696 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 679 <Caret Line="5 34" Column="1" TopLine="514"/>697 <Caret Line="562" Column="4" TopLine="548"/> 680 698 </Position17> 681 699 <Position18> 682 700 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 683 <Caret Line=" 531" Column="1" TopLine="514"/>701 <Caret Line="99" Column="17" TopLine="91"/> 684 702 </Position18> 685 703 <Position19> 686 <Filename Value="..\Compiler\Analyze\UAnalyzer Pascal.pas"/>687 <Caret Line=" 534" Column="1" TopLine="514"/>704 <Filename Value="..\Compiler\Analyze\UAnalyzer.pas"/> 705 <Caret Line="79" Column="30" TopLine="66"/> 688 706 </Position19> 689 707 <Position20> 690 708 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 691 <Caret Line=" 537" Column="1" TopLine="522"/>709 <Caret Line="99" Column="45" TopLine="86"/> 692 710 </Position20> 693 711 <Position21> 694 712 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 695 <Caret Line=" 546" Column="1" TopLine="525"/>713 <Caret Line="108" Column="1" TopLine="86"/> 696 714 </Position21> 697 715 <Position22> 698 <Filename Value="..\Compiler\ Analyze\UAnalyzerPascal.pas"/>699 <Caret Line=" 517" Column="1" TopLine="510"/>716 <Filename Value="..\Compiler\UCompiler.pas"/> 717 <Caret Line="79" Column="19" TopLine="63"/> 700 718 </Position22> 701 719 <Position23> 702 <Filename Value="..\Compiler\ Analyze\UAnalyzerPascal.pas"/>703 <Caret Line=" 521" Column="1" TopLine="510"/>720 <Filename Value="..\Compiler\UCompiler.pas"/> 721 <Caret Line="73" Column="1" TopLine="60"/> 704 722 </Position23> 705 723 <Position24> 706 <Filename Value="..\Compiler\ Analyze\UAnalyzerPascal.pas"/>707 <Caret Line=" 525" Column="1" TopLine="510"/>724 <Filename Value="..\Compiler\UCompiler.pas"/> 725 <Caret Line="74" Column="1" TopLine="60"/> 708 726 </Position24> 709 727 <Position25> 710 <Filename Value="..\Compiler\ Analyze\UAnalyzerPascal.pas"/>711 <Caret Line=" 530" Column="1" TopLine="510"/>728 <Filename Value="..\Compiler\UCompiler.pas"/> 729 <Caret Line="76" Column="1" TopLine="60"/> 712 730 </Position25> 713 731 <Position26> 714 <Filename Value=" ..\Compiler\Analyze\UAnalyzerPascal.pas"/>715 <Caret Line=" 531" Column="1" TopLine="510"/>732 <Filename Value="Forms\UMainForm.pas"/> 733 <Caret Line="114" Column="54" TopLine="107"/> 716 734 </Position26> 717 735 <Position27> 718 <Filename Value=" ..\Compiler\Analyze\UAnalyzerPascal.pas"/>719 <Caret Line=" 534" Column="1" TopLine="519"/>736 <Filename Value="Forms\UMainForm.pas"/> 737 <Caret Line="125" Column="3" TopLine="114"/> 720 738 </Position27> 721 739 <Position28> 722 <Filename Value=" ..\Compiler\Analyze\UAnalyzerPascal.pas"/>723 <Caret Line=" 537" Column="1" TopLine="519"/>740 <Filename Value="Forms\UMainForm.pas"/> 741 <Caret Line="97" Column="41" TopLine="84"/> 724 742 </Position28> 725 743 <Position29> 726 <Filename Value=" ..\Compiler\Analyze\UAnalyzerPascal.pas"/>727 <Caret Line=" 546" Column="1" TopLine="536"/>744 <Filename Value="Forms\UMainForm.pas"/> 745 <Caret Line="75" Column="42" TopLine="62"/> 728 746 </Position29> 729 <Position30>730 <Filename Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/>731 <Caret Line="550" Column="47" TopLine="540"/>732 </Position30>733 747 </JumpHistory> 734 748 </ProjectOptions> … … 772 786 </CompilerOptions> 773 787 <Debugging> 774 <BreakPoints Count=" 3">788 <BreakPoints Count="4"> 775 789 <Item1> 776 790 <Source Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 777 <Line Value="120 5"/>791 <Line Value="1204"/> 778 792 </Item1> 779 793 <Item2> 780 794 <Source Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 781 <Line Value="12 30"/>795 <Line Value="1229"/> 782 796 </Item2> 783 797 <Item3> 784 798 <Source Value="..\Compiler\Analyze\UAnalyzerPascal.pas"/> 785 <Line Value="10 40"/>799 <Line Value="1039"/> 786 800 </Item3> 801 <Item4> 802 <Source Value="..\Compiler\UCompiler.pas"/> 803 <Line Value="73"/> 804 </Item4> 787 805 </BreakPoints> 788 806 <Exceptions Count="3">
Note:
See TracChangeset
for help on using the changeset viewer.