mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-14 14:32:43 +02:00
added syneditregexsearch.pas
git-svn-id: trunk@3165 -
This commit is contained in:
parent
83894d1dc1
commit
f0590fba4f
@ -442,13 +442,13 @@ interface
|
|||||||
|
|
||||||
{$IFNDEF FPC}
|
{$IFNDEF FPC}
|
||||||
{$DEFINE reRealExceptionAddr} // if defined then exceptions will
|
{$DEFINE reRealExceptionAddr} // if defined then exceptions will
|
||||||
{$ENDIF}
|
|
||||||
// jump to appropriate source line, not to Error procedure
|
// jump to appropriate source line, not to Error procedure
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
{$DEFINE ComplexBraces} // define for beta-version of braces
|
{$DEFINE ComplexBraces} // define for beta-version of braces
|
||||||
// (in stable version it works only for simple cases)
|
// (in stable version it works only for simple cases)
|
||||||
|
|
||||||
{.$DEFINE UniCode} // define for Unicode support
|
{off $DEFINE UniCode} // define for Unicode support
|
||||||
|
|
||||||
{$IFNDEF UniCode} // optionts applicable only for non-UniCode
|
{$IFNDEF UniCode} // optionts applicable only for non-UniCode
|
||||||
{$DEFINE UseSetOfChar} // Significant optimization by using set of char
|
{$DEFINE UseSetOfChar} // Significant optimization by using set of char
|
||||||
@ -526,36 +526,35 @@ const
|
|||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
NSUBEXP = 15; // max number of subexpression //###0.929
|
NSUBEXP = 15; // max number of subexpression //###0.929
|
||||||
// Cannot be more than NSUBEXPMAX
|
// Cannot be more than NSUBEXPMAX
|
||||||
// Be carefull - don't use values which overflow CLOSE opcode
|
// Be carefull - don't use values which overflow CLOSE opcode
|
||||||
// (in this case you'll get compiler erorr).
|
// (in this case you'll get compiler erorr).
|
||||||
// Big NSUBEXP will cause more slow work and more stack required
|
// Big NSUBEXP will cause more slow work and more stack required
|
||||||
NSUBEXPMAX = 255; // Max possible value for NSUBEXP. //###0.945
|
NSUBEXPMAX = 255; // Max possible value for NSUBEXP. //###0.945
|
||||||
// Don't change it! It's defined by internal TRegExpr design.
|
// Don't change it! It's defined by internal TRegExpr design.
|
||||||
|
|
||||||
MaxBracesArg = $7FFFFFFF - 1; // max value for {n,m} arguments //###0.933
|
MaxBracesArg = $7FFFFFFF - 1; // max value for {n,m} arguments //###0.933
|
||||||
|
|
||||||
{$IFDEF ComplexBraces}
|
{$IFDEF ComplexBraces}
|
||||||
LoopStackMax = 10; // max depth of loops stack //###0.925
|
LoopStackMax = 10; // max depth of loops stack //###0.925
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
TinySetLen = 3;
|
TinySetLen = 3;
|
||||||
// if range includes more then TinySetLen chars, //###0.934
|
// if range includes more then TinySetLen chars, //###0.934
|
||||||
// then use full (32 bytes) ANYOFFULL instead of ANYOF[BUT]TINYSET
|
// then use full (32 bytes) ANYOFFULL instead of ANYOF[BUT]TINYSET
|
||||||
// !!! Attension ! If you change TinySetLen, you must
|
// !!! Attension ! If you change TinySetLen, you must
|
||||||
// change code marked as "//!!!TinySet"
|
// change code marked as "//!!!TinySet"
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{$IFDEF UseSetOfChar}
|
{$IFDEF UseSetOfChar}
|
||||||
PSetOfREChar = ^TSetOfREChar;
|
PSetOfREChar = ^TSetOfREChar;
|
||||||
TSetOfREChar = set of REChar;
|
TSetOfREChar = set of REChar;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
TRegExpr = class
|
TRegExpr = class
|
||||||
private
|
private
|
||||||
startp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr starting points
|
startp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr starting points
|
||||||
endp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr end points
|
endp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr end points
|
||||||
|
|
||||||
@ -923,8 +922,8 @@ type
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ERegExpr = class (Exception)
|
ERegExpr = class (Exception)
|
||||||
public
|
public
|
||||||
ErrorCode : integer;
|
ErrorCode : integer;
|
||||||
CompilerErrorPos : integer;
|
CompilerErrorPos : integer;
|
||||||
end;
|
end;
|
||||||
@ -991,27 +990,27 @@ uses
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$IFNDEF LINUX} //js 07-04-2002 only use windows in non-CLX-envirolment -- SYN_CLX doesn't work, why?
|
{$IFNDEF LINUX} //js 07-04-2002 only use windows in non-CLX-envirolment -- SYN_CLX doesn't work, why?
|
||||||
uses
|
uses
|
||||||
Windows; // CharUpper/Lower
|
Windows; // CharUpper/Lower
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
const
|
const
|
||||||
TRegExprVersionMajor : integer = 0;
|
TRegExprVersionMajor : integer = 0;
|
||||||
TRegExprVersionMinor : integer = 947;
|
TRegExprVersionMinor : integer = 947;
|
||||||
// don't use this const directly, use TRegExpr.VersionXXX instead
|
// don't use this const directly, use TRegExpr.VersionXXX instead
|
||||||
|
|
||||||
MaskModI = 1; // modifier /i bit in fModifiers
|
MaskModI = 1; // modifier /i bit in fModifiers
|
||||||
MaskModR = 2; // -"- /r
|
MaskModR = 2; // -"- /r
|
||||||
MaskModS = 4; // -"- /s
|
MaskModS = 4; // -"- /s
|
||||||
MaskModG = 8; // -"- /g
|
MaskModG = 8; // -"- /g
|
||||||
MaskModM = 16; // -"- /m
|
MaskModM = 16; // -"- /m
|
||||||
MaskModX = 32; // -"- /x
|
MaskModX = 32; // -"- /x
|
||||||
|
|
||||||
{$IFDEF UniCode}
|
{$IFDEF UniCode}
|
||||||
XIgnoredChars = ' '#9#$d#$a;
|
XIgnoredChars = ' '#9#$d#$a;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
XIgnoredChars = [' ', #9, #$d, #$a];
|
XIgnoredChars = [' ', #9, #$d, #$a];
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{=============================================================}
|
{=============================================================}
|
||||||
{=================== WideString functions ====================}
|
{=================== WideString functions ====================}
|
||||||
@ -1020,24 +1019,24 @@ const
|
|||||||
{$IFDEF UniCode}
|
{$IFDEF UniCode}
|
||||||
|
|
||||||
function StrPCopy (Dest: PRegExprChar; const Source: RegExprString): PRegExprChar;
|
function StrPCopy (Dest: PRegExprChar; const Source: RegExprString): PRegExprChar;
|
||||||
var
|
var
|
||||||
i, Len : Integer;
|
i, Len : Integer;
|
||||||
begin
|
begin
|
||||||
Len := length (Source); //###0.932
|
Len := length (Source); //###0.932
|
||||||
for i := 1 to Len do
|
for i := 1 to Len do
|
||||||
Dest [i - 1] := Source [i];
|
Dest [i - 1] := Source [i];
|
||||||
Dest [Len] := #0;
|
Dest [Len] := #0;
|
||||||
Result := Dest;
|
Result := Dest;
|
||||||
end; { of function StrPCopy
|
end; { of function StrPCopy
|
||||||
--------------------------------------------------------------}
|
--------------------------------------------------------------}
|
||||||
|
|
||||||
function StrLCopy (Dest, Source: PRegExprChar; MaxLen: Cardinal): PRegExprChar;
|
function StrLCopy (Dest, Source: PRegExprChar; MaxLen: Cardinal): PRegExprChar;
|
||||||
var i: Integer;
|
var i: Integer;
|
||||||
begin
|
begin
|
||||||
for i := 0 to MaxLen - 1 do
|
for i := 0 to MaxLen - 1 do
|
||||||
Dest [i] := Source [i];
|
Dest [i] := Source [i];
|
||||||
Result := Dest;
|
Result := Dest;
|
||||||
end; { of function StrLCopy
|
end; { of function StrLCopy
|
||||||
--------------------------------------------------------------}
|
--------------------------------------------------------------}
|
||||||
|
|
||||||
function StrLen (Str: PRegExprChar): Cardinal;
|
function StrLen (Str: PRegExprChar): Cardinal;
|
||||||
|
Loading…
Reference in New Issue
Block a user