Jedi code format: Fix issue #40980, exception on unterminated string.

This commit is contained in:
DomingoGP 2024-06-01 14:21:10 +02:00
parent 92306de965
commit 7fe3cecf9a
2 changed files with 12 additions and 3 deletions

View File

@ -513,7 +513,7 @@ begin
{ read until the close ''' }
repeat
if Current = #0 then
Raise Exception.Create(Format(lisMsgUnterminatedString,[pcToken.SourceCode]));
raise TEParseError.Create(Format(lisMsgUnterminatedString,[pcToken.SourceCode]),pcToken);
if (Current = NativeSingleQuote) then
begin
@ -556,7 +556,7 @@ begin
if Current = #0 then
break;
if CharIsReturn(Current) then
Raise Exception.Create(Format(lisMsgUnterminatedString,[pcToken.SourceCode]));
raise TEParseError.Create(Format(lisMsgUnterminatedString,[pcToken.SourceCode]),pcToken);
{ two quotes in a row are still part of the string }
if (Current = pcDelimiter) then

View File

@ -164,7 +164,16 @@ begin
fcTokeniser.SourceCode := InputCode;
fcTokeniser.FileName := FileName;
lcTokenList := TSourceTokenList.Create;
fcTokeniser.BuildTokenList(lcTokenList);
try
fcTokeniser.BuildTokenList(lcTokenList);
except
on E: Exception do
begin
fbConvertError := True;
SendStatusMessage('', Format(lisMsgExpectionClassMsg, ['', E.Message]), mtException, -1, -1);
Exit;
end;
end;
try { finally free the list }
try { show exceptions }
fiTokenCount := lcTokenList.Count;