mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 22:59:15 +02:00
LazUtils: CompileAnyCharOrNone: ifdef all debug output. Remove unneeded comments.
Note: code still contains writeln's, so it will crash if no console is available.
This commit is contained in:
parent
905d99b813
commit
cb530a9063
@ -17,7 +17,7 @@ unit Masks;
|
|||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
{$define debug_maskcompiled}
|
{$define debug_maskcompiled}
|
||||||
{$define debug_anycharornone}
|
{.$define debug_anycharornone}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@ -1005,30 +1005,13 @@ procedure TMaskUTF8.CompileAnyCharOrNone(QChar: Char; BracketsRequired: Boolean)
|
|||||||
var
|
var
|
||||||
QCount, lCharsGroupInsertSize: Integer;
|
QCount, lCharsGroupInsertSize: Integer;
|
||||||
begin
|
begin
|
||||||
{
|
|
||||||
Add: CharsGroupBegin
|
|
||||||
lCharsGroupInsertSize:=fMaskCompiledIndex;
|
|
||||||
Add(0)
|
|
||||||
Add: AnyCharOrNone
|
|
||||||
Add(1)
|
|
||||||
TMaskBase.IncrementLastCounterBy: aOPcode=AnyCharOrNone, aValue=1 number of zero's -1
|
|
||||||
lCharsGroupInsertSize=1
|
|
||||||
PInteger(@fMaskCompiled[lCharsGroupInsertSize])^:=fMaskCompiledIndex;
|
|
||||||
Add: CharsGroupEnd
|
|
||||||
Inc(fMatchMaximumLiteralBytes,number of zero's *4);
|
|
||||||
Set fMaskInd to last zero (+Count-1)
|
|
||||||
}
|
|
||||||
//if any of the 2 conditions is true, this procedure should not have been called.
|
//if any of the 2 conditions is true, this procedure should not have been called.
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF debug_anycharornone}
|
{$IFDEF debug_anycharornone}
|
||||||
if BracketsRequired and (fMask[fMaskInd]<>'[') then
|
if BracketsRequired and (fMask[fMaskInd]<>'[') then
|
||||||
Exception_InternalError();
|
Exception_InternalError();
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if BracketsRequired then
|
if BracketsRequired then
|
||||||
Inc(fMaskInd); //consume the '['
|
Inc(fMaskInd); //consume the '['
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF debug_anycharornone}
|
{$IFDEF debug_anycharornone}
|
||||||
if fMask[fMaskInd]<>QChar then
|
if fMask[fMaskInd]<>QChar then
|
||||||
Exception_InternalError();
|
Exception_InternalError();
|
||||||
@ -1036,14 +1019,18 @@ begin
|
|||||||
|
|
||||||
QCount:=1;
|
QCount:=1;
|
||||||
while (fMaskInd+QCount<=fMaskLimit) and (fMask[fMaskInd+QCount]=QChar) do Inc(QCount);
|
while (fMaskInd+QCount<=fMaskLimit) and (fMask[fMaskInd+QCount]=QChar) do Inc(QCount);
|
||||||
|
{$IFDEF debug_anycharornone}
|
||||||
writeln('CompileAnyCharOrNone: Nr of AnyCharOrNone-tokens: ',QCount);
|
writeln('CompileAnyCharOrNone: Nr of AnyCharOrNone-tokens: ',QCount);
|
||||||
|
|
||||||
if (fMaskInd+QCount>fMaskLimit) then writeln('(fMaskInd+QCount>fMaskLimit): ',fMaskInd+QCount,'>',fMaskLimit);
|
if (fMaskInd+QCount>fMaskLimit) then writeln('(fMaskInd+QCount>fMaskLimit): ',fMaskInd+QCount,'>',fMaskLimit);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
//is Last found QChar also last character of the mask, while we expect a closing ']'?
|
//is Last found QChar also last character of the mask, while we expect a closing ']'?
|
||||||
if BracketsRequired and (fMaskInd+QCount>fMaskLimit) then
|
if BracketsRequired and (fMaskInd+QCount>fMaskLimit) then
|
||||||
Exception_MissingCloseChar(']',fMaskInd+QCount-1);
|
Exception_MissingCloseChar(']',fMaskInd+QCount-1);
|
||||||
|
|
||||||
|
{$IFDEF debug_anycharornone}
|
||||||
if not (fMask[fMaskInd+QCount]=']') then writeln('fMask[fMaskInd+QCount]: expected ], found: ',fMask[fMaskInd+QCount]);
|
if not (fMask[fMaskInd+QCount]=']') then writeln('fMask[fMaskInd+QCount]: expected ], found: ',fMask[fMaskInd+QCount]);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
if BracketsRequired and not (fMask[fMaskInd+QCount]=']') then
|
if BracketsRequired and not (fMask[fMaskInd+QCount]=']') then
|
||||||
Exception_InvalidCharMask(fMask[fMaskInd+QCount],fMaskInd+QCount);
|
Exception_InvalidCharMask(fMask[fMaskInd+QCount],fMaskInd+QCount);
|
||||||
@ -1066,8 +1053,8 @@ begin
|
|||||||
|
|
||||||
{$IFDEF debug_anycharornone}
|
{$IFDEF debug_anycharornone}
|
||||||
write('fMaskInd=',fMaskInd,', fMaskLimit=',fMaskLimit,' fMask[fMaskInd]=');if fMaskInd<=fMaskLimit then writeln('#',Ord(fMask[fMaskInd]),': ',fMask[fMaskInd])else writeln('>>');
|
write('fMaskInd=',fMaskInd,', fMaskLimit=',fMaskLimit,' fMask[fMaskInd]=');if fMaskInd<=fMaskLimit then writeln('#',Ord(fMask[fMaskInd]),': ',fMask[fMaskInd])else writeln('>>');
|
||||||
{$ENDIF}
|
|
||||||
writeln('CompileAnyCharOrNone end.');
|
writeln('CompileAnyCharOrNone end.');
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMaskUTF8.Compile;
|
procedure TMaskUTF8.Compile;
|
||||||
|
Loading…
Reference in New Issue
Block a user