mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 12:13:12 +02:00
* Fix error messages, operator keyword starts new section
git-svn-id: trunk@36925 -
This commit is contained in:
parent
c929e0285b
commit
86ab5a4fd0
@ -2895,7 +2895,7 @@ begin
|
|||||||
CurBlock := declNone;
|
CurBlock := declNone;
|
||||||
while True do
|
while True do
|
||||||
begin
|
begin
|
||||||
if CurBlock=DeclNone then
|
if CurBlock in [DeclNone,declConst] then
|
||||||
Scanner.SetTokenOption(toOperatorToken)
|
Scanner.SetTokenOption(toOperatorToken)
|
||||||
else
|
else
|
||||||
Scanner.UnSetTokenOption(toOperatorToken);
|
Scanner.UnSetTokenOption(toOperatorToken);
|
||||||
@ -3874,13 +3874,21 @@ end;
|
|||||||
|
|
||||||
procedure TPasParser.DoLog(MsgType: TMessageType; MsgNumber: integer;
|
procedure TPasParser.DoLog(MsgType: TMessageType; MsgNumber: integer;
|
||||||
const Fmt: String; Args: array of const; SkipSourceInfo: Boolean);
|
const Fmt: String; Args: array of const; SkipSourceInfo: Boolean);
|
||||||
|
|
||||||
|
Var
|
||||||
|
Msg : String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
SetLastMsg(MsgType,MsgNumber,Fmt,Args);
|
SetLastMsg(MsgType,MsgNumber,Fmt,Args);
|
||||||
If Assigned(FOnLog) then
|
If Assigned(FOnLog) then
|
||||||
|
begin
|
||||||
|
Msg:=MessageTypeNames[MsgType]+': ';
|
||||||
if SkipSourceInfo or not assigned(scanner) then
|
if SkipSourceInfo or not assigned(scanner) then
|
||||||
FOnLog(Self,FLastMsg)
|
Msg:=Msg+FLastMsg
|
||||||
else
|
else
|
||||||
FOnLog(Self,Format('%s(%d) : %s',[Scanner.CurFilename,Scanner.CurRow,FLastMsg]));
|
Msg:=Msg+Format('%s(%d,%d) : %s',[Scanner.CurFilename,Scanner.CurRow,Scanner.CurColumn,FLastMsg]);
|
||||||
|
FOnLog(Self,Msg);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPasParser.ParseInlineVarDecl(Parent: TPasElement; List: TFPList;
|
procedure TPasParser.ParseInlineVarDecl(Parent: TPasElement; List: TFPList;
|
||||||
|
@ -843,6 +843,11 @@ const
|
|||||||
const
|
const
|
||||||
AllLanguageModes = [msFPC,msObjFPC,msDelphi,msTP7,msMac,msISO,msExtPas];
|
AllLanguageModes = [msFPC,msObjFPC,msDelphi,msTP7,msMac,msISO,msExtPas];
|
||||||
|
|
||||||
|
Const
|
||||||
|
MessageTypeNames : Array[TMessageType] of string = (
|
||||||
|
'Fatal','Error','Warning','Note','Hint','Info','Debug'
|
||||||
|
);
|
||||||
|
|
||||||
const
|
const
|
||||||
// all mode switches supported by FPC
|
// all mode switches supported by FPC
|
||||||
msAllFPCModeSwitches = [low(TModeSwitch)..High(TModeSwitch)];
|
msAllFPCModeSwitches = [low(TModeSwitch)..High(TModeSwitch)];
|
||||||
@ -2403,14 +2408,14 @@ end;
|
|||||||
procedure TPascalScanner.Error(MsgNumber: integer; const Msg: string);
|
procedure TPascalScanner.Error(MsgNumber: integer; const Msg: string);
|
||||||
begin
|
begin
|
||||||
SetCurMsg(mtError,MsgNumber,Msg,[]);
|
SetCurMsg(mtError,MsgNumber,Msg,[]);
|
||||||
raise EScannerError.Create(FLastMsg);
|
raise EScannerError.CreateFmt('Error: %s(%d,%d) : %s',[CurFilename,CurRow,CurColumn,FLastMsg]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPascalScanner.Error(MsgNumber: integer; const Fmt: string;
|
procedure TPascalScanner.Error(MsgNumber: integer; const Fmt: string;
|
||||||
Args: array of const);
|
Args: array of const);
|
||||||
begin
|
begin
|
||||||
SetCurMsg(mtError,MsgNumber,Fmt,Args);
|
SetCurMsg(mtError,MsgNumber,Fmt,Args);
|
||||||
raise EScannerError.Create(FLastMsg);
|
raise EScannerError.CreateFmt('Error: %s(%d,%d) : %s',[CurFilename,CurRow,CurColumn,FLastMsg]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPascalScanner.DoFetchTextToken:TToken;
|
function TPascalScanner.DoFetchTextToken:TToken;
|
||||||
@ -3531,13 +3536,21 @@ end;
|
|||||||
|
|
||||||
procedure TPascalScanner.DoLog(MsgType: TMessageType; MsgNumber: integer;
|
procedure TPascalScanner.DoLog(MsgType: TMessageType; MsgNumber: integer;
|
||||||
const Fmt: String; Args: array of const; SkipSourceInfo: Boolean);
|
const Fmt: String; Args: array of const; SkipSourceInfo: Boolean);
|
||||||
|
|
||||||
|
Var
|
||||||
|
Msg : String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
SetCurMsg(MsgType,MsgNumber,Fmt,Args);
|
SetCurMsg(MsgType,MsgNumber,Fmt,Args);
|
||||||
If Assigned(FOnLog) then
|
If Assigned(FOnLog) then
|
||||||
|
begin
|
||||||
|
Msg:=MessageTypeNames[MsgType]+': ';
|
||||||
if SkipSourceInfo then
|
if SkipSourceInfo then
|
||||||
FOnLog(Self,FLastMsg)
|
Msg:=Msg+FLastMsg
|
||||||
else
|
else
|
||||||
FOnLog(Self,Format('%s(%d) : %s',[FCurFileName,FCurRow,FLastMsg]));
|
Msg:=Msg+Format('%s(%d,%d) : %s',[FCurFileName,CurRow,CurColumn,FLastMsg]);
|
||||||
|
FOnLog(Self,Msg);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPascalScanner.SetOptions(AValue: TPOptions);
|
procedure TPascalScanner.SetOptions(AValue: TPOptions);
|
||||||
|
Loading…
Reference in New Issue
Block a user