[Lazarus] TMask revisited

Bart bartjunk64 at gmail.com
Tue Oct 19 16:32:29 CEST 2021


On Tue, Oct 19, 2021 at 10:44 AM José Mejuto via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

> Yes, at least it should. To completely disable the "[" syntax three
> options must be removed from default, "eMaskOpcodeOptionalChar",
> "eMaskOpcodeRange" and "eMaskOpcodeAnyCharOrNone".
>
> eMaskOpcodeAnyCharOrNone = [???] matches 0, 1, 2 or 3 chars.
> eMaskOpcodeRange = [a-z] matches 1 char from "a" to "z".
> eMaskOpcodeOptionalChar = [abc] matches "a" or "b" or "c"
>
> With the three options disabled "[" is interpreted as a regular
> character to be matched.
>
> With "eMaskOpcodeRange" and "eMaskOpcodeOptionalChar" enabled to match
> "a" or "-" or "z" the "-" must be escaped (something like regex) using
> the escapechar, by default "\", in this way "[a\-z]".

Thanks for explaining that.
Sounds to me like you should not enable both of them, unless you want
something to match 'a'..'f' or '+' or '-' [a-f+\-] ?

Lots of documentation to do.

With only eMaskOpcodeOptionalChar enabled [a-z] would match 'a', '-' or 'z'?
(This would be the old behaviour of TMask)

The eMaskOpcodeOptionalChar enum name is not very self-explanatory,
maybe we should come up with another name (better now than in half a
year).

And maybe a constant that has all opcodes except the ones that enable ranges.

-- 
Bart


More information about the lazarus mailing list