andgineer / TRegExpr

Regular expressions (regex), pascal.
https://regex.sorokin.engineer/en/latest/
MIT License
174 stars 63 forks source link

Compile problems with delphi 7 #252

Closed HPWi closed 3 years ago

HPWi commented 3 years ago

Hello,

Trying to compile with delphi 7 without success:

function TRegExpr.DumpCheckerIndex(N: byte): RegExprString; begin Result := '?'; if N = CheckerIndex_Word then Exit('\w'); ... ...

Exit with parameters not supported by D7- Changed to: if N = CheckerIndex_Word then Result := '\w';

function TRegExpr.DumpCategoryChars(ch, ch2: REChar; Positive: boolean): RegExprString; const S: array[boolean] of REChar = ('P', 'p'); begin Result := '\' + S[Positive] + '{' + ch;

S[Positive] produce an error about type mismatch. What to do?

Regards Hans-Peter

HPWi commented 3 years ago

As a workaround I changed to:

function TRegExpr.DumpCategoryChars(ch, ch2: REChar; Positive: boolean): RegExprString; begin if Positive then Result := '\' + 'P' + '{' + ch else Result := '\' + 'p' + '{' + ch;

Now it compiles. ;-)

Alexey-T commented 3 years ago

Fixed in my fork. https://github.com/Alexey-T/tregexpr