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

This commit is contained in:
DomingoGP 2024-06-08 19:19:32 +02:00
parent 2216170cde
commit 41db711cbc
2 changed files with 11 additions and 2 deletions

View File

@ -503,7 +503,7 @@ begin
if Current = #0 then
break;
if CharIsReturn(Current) then
Raise Exception.Create('Unterminated string: ' + pcToken.SourceCode);
Raise TEParseError.Create('Unterminated string: ' + pcToken.SourceCode, pcToken);
{ two quotes in a row are still part of the string }
if (Current = pcDelimiter) then

View File

@ -161,7 +161,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('Exception %s %s', ['', E.Message]), mtException, -1, -1);
Exit;
end;
end;
try { finally free the list }
try { show exceptions }
fiTokenCount := lcTokenList.Count;