[Lazarus] TMask revisited

Juha Manninen juha.manninen62 at gmail.com
Sat Oct 16 23:19:47 CEST 2021


I turned the define RANGES_AUTOREVERSE into a run time option in
67111d9a30.
A boolean RangeAutoReverse is True by default. I don't really know when
somebody would want to turn it off.

I also added constructors and functions for legacy syntax, which means [?]
represents a literal '?' and characters cannot be escaped with '\'.
  constructor CreateLegacy() etc.
That was the syntax used earlier but the default syntax now is improved.
[?] is a wildcard and means 0 or 1 characters. Remember, '?' alone is 1
character.
[??] means 0,1 or 2 chars. Useful and quite intuitive.
Any character can be escaped with '\' now. For example literal '?' is \?,
and literal '*' is \*.
In the Windows mask syntax that is always disabled for obvious reasons.

Question is, should the old legacy syntax be used when default constructors
and functions are called? Like TMask.Create() etc.
Then the improved syntax would be supported by constructors having
different names.
Mask syntax has no standards. They have evolved and diversified. How does
Delphi's Mask work?
A positive fact however is that some 99.5% of masks use simple '?' and '*'
wildcards and continue to work in any case.

The TMask syntax can be tweaked in many ways. A set TMaskOpcodesSet can be
passed as a parameter to constructors / functions.
I made constants MaskOpCodesDisableRange which treats all brackets [..] as
literal characters
and MaskOpCodesNoEscape which is the "legacy" syntax explained above.
The Windows style mask can be tweaked with TWindowsQuirkSet.

Ideas? Comments?

Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20211017/d1bd48b4/attachment.html>


More information about the lazarus mailing list