Ignore:
Timestamp:
Aug 10, 2010, 1:48:38 PM (14 years ago)
Author:
george
Message:

Fix: View proper source file after click to error message.
Made partial changes to support unit interface and implementation sections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/UCompiler.pas

    r54 r55  
    1515    Text: string;
    1616    Position: TPoint;
     17    FileName: string;
    1718  end;
    1819
     
    2223  private
    2324    FOnErrorMessage: TOnErrorMessage;
     25    FFileName: string;
    2426    procedure ErrorMessage(Text: string; Position: TPoint);
    2527  public
     
    3032    constructor Create;
    3133    procedure Init;
    32     procedure Compile(Source: TStringList; ProducedCode: TStringList);
     34    procedure Compile(ModuleName: string; Source: TStringList; ProducedCode: TStringList);
    3335    destructor Destroy; override;
    34     property OnErrorMessage: TOnErrorMessage read FOnErrorMessage write FOnErrorMessage;
     36    property OnErrorMessage: TOnErrorMessage read FOnErrorMessage
     37      write FOnErrorMessage;
    3538  end;
    3639
     
    3942{ TCompiler }
    4043
    41 procedure TCompiler.Compile(Source: TStringList; ProducedCode: TStringList);
     44procedure TCompiler.Compile(ModuleName: string; Source: TStringList; ProducedCode: TStringList);
    4245var
    4346  NewModule: TModule;
    4447begin
     48  FFileName := ModuleName;
    4549  Parser.SourceCodeText := Source;
    4650  Parser.Init;
    47   NewModule := TModule.Create;
    48   ProgramCode.Modules.Add(NewModule);
    49   Parser.ParseModule(NewModule);
     51  ProgramCode.Modules.Add(Parser.ParseModule);
    5052  Producer.Produce(NewModule, ProducedCode);
    5153end;
     
    8183  NewMessage.Text := Text;
    8284  NewMessage.Position := Position;
     85  NewMessage.FileName := FFileName;
    8386  ErrorMessages.Add(NewMessage);
    8487  if Assigned(FOnErrorMessage) then FOnErrorMessage(Text, Position);
Note: See TracChangeset for help on using the changeset viewer.