mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +02:00
* Patch from Alexey Torgashin for unquotechar issue 266. Fix issue #39696
This commit is contained in:
parent
ac95c20c5a
commit
96c6045023
@ -482,7 +482,7 @@ type
|
||||
|
||||
function HexDig(Ch: REChar): integer;
|
||||
|
||||
function UnQuoteChar(var APtr: PRegExprChar): REChar;
|
||||
function UnQuoteChar(var APtr, AEnd: PRegExprChar): REChar;
|
||||
|
||||
// the lowest level
|
||||
function ParseAtom(var FlagParse: integer): PRegExprChar;
|
||||
@ -817,7 +817,7 @@ uses
|
||||
const
|
||||
// TRegExpr.VersionMajor/Minor return values of these constants:
|
||||
REVersionMajor = 1;
|
||||
REVersionMinor = 153;
|
||||
REVersionMinor = 154;
|
||||
|
||||
OpKind_End = REChar(1);
|
||||
OpKind_MetaClass = REChar(2);
|
||||
@ -3411,7 +3411,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRegExpr.UnQuoteChar(var APtr: PRegExprChar): REChar;
|
||||
function TRegExpr.UnQuoteChar(var APtr, AEnd: PRegExprChar): REChar;
|
||||
var
|
||||
Ch: REChar;
|
||||
begin
|
||||
@ -3432,7 +3432,7 @@ begin
|
||||
begin // \cK => code for Ctrl+K
|
||||
Result := #0;
|
||||
Inc(APtr);
|
||||
if APtr >= fRegexEnd then
|
||||
if APtr >= AEnd then
|
||||
Error(reeNoLetterAfterBSlashC);
|
||||
Ch := APtr^;
|
||||
case Ch of
|
||||
@ -3448,7 +3448,7 @@ begin
|
||||
begin // \x: hex char
|
||||
Result := #0;
|
||||
Inc(APtr);
|
||||
if APtr >= fRegexEnd then
|
||||
if APtr >= AEnd then
|
||||
begin
|
||||
Error(reeNoHexCodeAfterBSlashX);
|
||||
Exit;
|
||||
@ -3457,7 +3457,7 @@ begin
|
||||
begin // \x{nnnn} //###0.936
|
||||
repeat
|
||||
Inc(APtr);
|
||||
if APtr >= fRegexEnd then
|
||||
if APtr >= AEnd then
|
||||
begin
|
||||
Error(reeNoHexCodeAfterBSlashX);
|
||||
Exit;
|
||||
@ -3481,7 +3481,7 @@ begin
|
||||
Result := REChar(HexDig(APtr^));
|
||||
// HexDig will cause Error if bad hex digit found
|
||||
Inc(APtr);
|
||||
if APtr >= fRegexEnd then
|
||||
if APtr >= AEnd then
|
||||
begin
|
||||
Error(reeNoHexCodeAfterBSlashX);
|
||||
Exit;
|
||||
@ -3692,7 +3692,7 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
Inc(regParse);
|
||||
RangeEnd := UnQuoteChar(regParse);
|
||||
RangeEnd := UnQuoteChar(regParse, fRegexEnd);
|
||||
end;
|
||||
|
||||
// special handling for Russian range a-YA, add 2 ranges: a-ya and A-YA
|
||||
@ -3763,7 +3763,7 @@ begin
|
||||
else
|
||||
{$ENDIF}
|
||||
begin
|
||||
TempChar := UnQuoteChar(regParse);
|
||||
TempChar := UnQuoteChar(regParse, fRegexEnd);
|
||||
// False if '-' is last char in []
|
||||
DashForRange :=
|
||||
(regParse + 2 < fRegexEnd) and
|
||||
@ -4206,7 +4206,7 @@ begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
else
|
||||
EmitExactly(UnQuoteChar(regParse));
|
||||
EmitExactly(UnQuoteChar(regParse, fRegexEnd));
|
||||
end; { of case }
|
||||
Inc(regParse);
|
||||
end;
|
||||
@ -5858,7 +5858,7 @@ begin
|
||||
begin
|
||||
p := p - 1;
|
||||
// UnquoteChar expects the escaped char under the pointer
|
||||
QuotedChar := UnQuoteChar(p);
|
||||
QuotedChar := UnQuoteChar(p, TemplateEnd);
|
||||
p := p + 1;
|
||||
// Skip after last part of the escaped sequence - UnquoteChar stops on the last symbol of it
|
||||
p0 := @QuotedChar;
|
||||
|
Loading…
Reference in New Issue
Block a user