[Lazarus] TMask revisited
José Mejuto
joshyfun at gmail.com
Sun Oct 17 19:37:10 CEST 2021
El 17/10/2021 a las 9:08, Juha Manninen via lazarus escribió:
>
> What does eMaskOpcodeOptionalChar do?
> It's not very clear to me from the comments in the code.
>
> Good question. It is the one syntax I don't fully understand yet.
> Below is an explanation from José himself. I will study this syntax
> later and add more unit test cases.
> ---
> eMaskOpcodeOptionalChar is the set "1[ab]2" matches "1a2" and "ab2" but
> not "1c2".
> ---
> I am not sure if it is correct. I will return to this later...
Hello,
OpcodeOptionalChar (maybe the name should be OptionChar) works in the
compiled stream as CheckMatch and if match go to next char; if not match
continue checking without advance in the target string.
Most people are familiar with ranges "[a-z]", optional chars use the
same "[" syntax but without the dash "-", so "[abcde]" matches one
position with any of those chars or if you negate the set "[!abcde]" it
will match any char *except* any of those.
Have a nice day.
--
More information about the lazarus
mailing list