lazdelphi: register parser

This commit is contained in:
mattias 2023-05-09 09:01:19 +02:00
parent 2bff2330c6
commit 5bcd4dfcc9

View File

@ -9,6 +9,7 @@ uses
const const
SubToolDelphi = 'Delphi'; SubToolDelphi = 'Delphi';
SubToolDelphiPriority = SubToolFPCPriority-10;
type type
@ -23,13 +24,16 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure ReadLine(Line: string; OutputIndex: integer; IsStdErr: boolean; procedure ReadLine(Line: string; OutputIndex: integer; IsStdErr: boolean;
var Handled: boolean); override; var Handled: boolean); override; // (worker thread)
class function DefaultSubTool: string; override; class function DefaultSubTool: string; override;
class function GetParserName: string; override;
class function GetLocalizedParserName: string; override;
class function Priority: integer; override;
end; end;
TDelphiCompilerParserClass = class of TDelphiCompilerParser; TDelphiCompilerParserClass = class of TDelphiCompilerParser;
var var
IDEDelphiCompilerParser: TDelphiCompilerParserClass = nil; IDEDelphiCompilerParserClass: TDelphiCompilerParserClass = nil;
procedure Register; procedure Register;
@ -37,7 +41,7 @@ implementation
procedure Register; procedure Register;
begin begin
ExternalToolList.RegisterParser(TDelphiCompilerParser);
end; end;
{ TDelphiCompilerParser } { TDelphiCompilerParser }
@ -45,12 +49,16 @@ end;
constructor TDelphiCompilerParser.Create(AOwner: TComponent); constructor TDelphiCompilerParser.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
// filename(linenumber): E2003 Undeclared identifier: 'foo'
FRegExprFilenameLineIDMsg:=TRegExpr.Create; FRegExprFilenameLineIDMsg:=TRegExpr.Create;
FRegExprFilenameLineIDMsg.ModifierStr:='I'; FRegExprFilenameLineIDMsg.ModifierStr:='I';
// filename(linenumber): E2003 Undeclared identifier: 'foo' FRegExprFilenameLineIDMsg.Expression:='^(.*)\(([0-9]+)\): ([HNWEF])([0-9]+) (.*)$';
FRegExprFilenameLineIDMsg.Expression:='^(.*)\([0-9]+)\): ([HNWEF])([0-9]+) (.*)$';
// filename(linenumber): Fatal: F2613 Unit 'Unit3' not found. // filename(linenumber): Fatal: F2613 Unit 'Unit3' not found.
FRegExprFilenameLineUrgencyIDMsg.Expression:='^(.*)\([0-9]+)\) ([a-zA-Z]+): ([HNWEF])([0-9]+) (.*)$'; FRegExprFilenameLineUrgencyIDMsg:=TRegExpr.Create;
FRegExprFilenameLineUrgencyIDMsg.ModifierStr:='I';
FRegExprFilenameLineUrgencyIDMsg.Expression:='^(.*)\(([0-9]+)\) ([a-zA-Z]+): ([HNWEF])([0-9]+) (.*)$';
end; end;
destructor TDelphiCompilerParser.Destroy; destructor TDelphiCompilerParser.Destroy;
@ -152,7 +160,22 @@ end;
class function TDelphiCompilerParser.DefaultSubTool: string; class function TDelphiCompilerParser.DefaultSubTool: string;
begin begin
Result:='dcc'; Result:='DCC';
end;
class function TDelphiCompilerParser.GetParserName: string;
begin
Result:='Delphi Compiler';
end;
class function TDelphiCompilerParser.GetLocalizedParserName: string;
begin
Result:='Delphi Compiler';
end;
class function TDelphiCompilerParser.Priority: integer;
begin
Result:=SubToolDelphiPriority;
end; end;
end. end.