mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 11:08:00 +02:00
SynEdit, PO highlighter: when highlighting strings, do not assume that all quote (") marks inside a string will be properly escaped (with \). E. g. this can be the case if file was edited manually. Instead, simply search for the last quote mark in the string. This change makes highlighter more resilient and also helps in POChecker, where PO strings are presented to user without escape symbols.
git-svn-id: trunk@57693 -
This commit is contained in:
parent
545e33e8c9
commit
1fd799fdfc
@ -252,16 +252,22 @@ end;
|
||||
|
||||
|
||||
procedure TSynPoSyn.StringProc;
|
||||
var
|
||||
LastQuotePos: longint;
|
||||
begin
|
||||
LastQuotePos := Run;
|
||||
fTokenID := tkString;
|
||||
repeat
|
||||
while FLine[Run] <> #0 do
|
||||
begin
|
||||
case FLine[Run] of
|
||||
#0, #10, #13: break;
|
||||
'\': if FLine[Run + 1] = #34 then Inc(Run); { \" means a literal " in the line}
|
||||
#10, #13: break;
|
||||
#34: LastQuotePos := Run;
|
||||
end;
|
||||
inc(Run);
|
||||
until FLine[Run] = #34;
|
||||
if FLine[Run] <> #0 then inc(Run);
|
||||
end;
|
||||
Run := LastQuotePos;
|
||||
if FLine[Run] <> #0 then
|
||||
inc(Run);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user