TC-1/2-Lexer Recurring Bugs
- Lexer patterns not reached
When scanning an input,
reflexmatches this input to the pattern with the longest character correspondence. With thesereflexpatterns:%% < > <> %%
and with
<>as input, reflex will use the<>pattern.However, when facing two patterns with the same correspondence length, it uses the first one (i.e. the one declared first). This is why you should always pay attention when using regex expressions that include other patterns.
%% [a-z]+ while %%
Here,
whilepattern is unreachable since it is matched by[a-z]+, defined first. To be able to distinguish these two cases, we need to switch their declaration order.