and the input Hello, the call to peek EOF is ignored and afterwards rejected as it doesn't consume any input, even if its valid.
This bug is a play between peek and the Op::ForwardIfConsumed operation which doesn't recognize that input was consumed because peek consumed input but reset it afterwards.
There is a workaround for this problem by defining T_EOL this way:
T_EOL : @{
peek EOF accept
peek ' '
}
It can also be reproduced when the two sequence are flipped, so
T_EOL : @{
peek ' '
peek EOF
}
Doesn't work either, but
T_EOL : @{
peek ' ' accept
peek EOF
}
does. Latter one does also work because the result is not reset, and the parselet accepts next:
Given this program
and the input
Hello
, the call topeek EOF
is ignored and afterwards rejected as it doesn't consume any input, even if its valid. This bug is a play between peek and the Op::ForwardIfConsumed operation which doesn't recognize that input was consumed because peek consumed input but reset it afterwards.There is a workaround for this problem by defining T_EOL this way:
It can also be reproduced when the two sequence are flipped, so
Doesn't work either, but
does. Latter one does also work because the result is not reset, and the parselet accepts next: