I'm a novice SableCC user and have run into the following tidbit:
I need to occasionally recognize epsilons (zero-length tokens)
in a grammar (yes, there IS a reason for that). The problem
can be extracted to and illustrated by the following toy grammar:
==== eps.sablecc ====
Package eps;
States
initial, rest;
Tokens
{initial -> rest} eps = ;
{rest} char = [0x0000 .. 0xffff];
Productions
whole = eps char*;
==== ends here ====
Zero-length tokens were never meant to be recognized. This is because the lexer
operates independently from the parser. Think about it: if zero-length tokens
were allowed, there's nothing that would stop the lexer from returning the same
zero-length token indefinitely (infinite loop).