TC-1/2-Lexer Recurring Bugs
- Lexer patterns not reached
When scanning an input,
reflex
matches this input to the pattern with the longest character correspondence. With thesereflex
patterns:%% < > <> %%
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,
while
pattern 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.