mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 02:33:38 +02:00
LazUtils: Masks: if mocSet, mocRange of mocAnyCharOrNone is enabled an unescaped '[' must always start such a construct and cannot be a literal.
This commit is contained in:
parent
c6e9b99232
commit
a9457c2f2b
@ -938,15 +938,15 @@ begin
|
||||
begin
|
||||
if ([mocSet,mocRange,
|
||||
mocAnyCharOrNone] * fMaskOpcodesAllowed <> [])
|
||||
and not
|
||||
(
|
||||
([mocSet,mocRange]*fMaskOpCodesAllowed = []) //only mocAnyCharOrNone enabled
|
||||
and
|
||||
(fMaskInd<fMaskLimit) and (fMask[fMaskInd+1]<>'?')// next char is not '?', so basically then the '[' is a literal
|
||||
)
|
||||
//in this case the '[' always mus be the start of a Range, a Set or AnyCharOrNone
|
||||
then
|
||||
CompileRange
|
||||
else begin //either mocSet,MocRange and mocAnyCharOrNone are all disabled, or only mocAnyCharOrNone is enabled and the '[' is not followed by a '?'
|
||||
begin //it's just a bit easier later on if we handle this before we call CompileRange
|
||||
if ([mocSet,mocRange]*fMaskOpCodesAllowed = []) {only mocAnyCharOrNone enabled}
|
||||
and (fMaskInd<fMaskLimit) and (fMask[fMaskInd+1]<>'?') {next char is not '?'} then
|
||||
Exception_InvalidCharMask(fMask[fMaskInd+1], fMaskInd+1);
|
||||
CompileRange;
|
||||
end
|
||||
else begin //mocSet,MocRange and mocAnyCharOrNone are all disabled
|
||||
{
|
||||
if (fMask[fMaskInd]=FMaskEscapeChar) and (mocEscapeChar in FMaskOpcodesAllowed) then begin //DEAD CODE?
|
||||
//This codepath could only be chosen if, at this point '[' is the escapechar
|
||||
|
Loading…
Reference in New Issue
Block a user