I would like to test my handling of that. But so far (with e.g. langs racket, rhombus, and scribble/manual) I'm always seeing a backup distance of zero.
What's an example of such a #lang?
What's some minimal example program in that #lang eliciting the non-zero backup?
I think a comment there provides a clue to an example test case. Assuming I can cash that in for a working example, I'll mark this self-answered. (Although if anyone knows any, I'd welcome more examples, as well as more #langs + examples.)
Another example is the at-exp lexer, which is "scribble-lexer.rkt" in "syntax-color-lib". A backup is needed when | might be a fancy opener like |<<{ or might be | followed by an S-expression and a closing |.
You really should see some non-0 backups with that example. If I put (log-error ">> ~s" backup) just after lex/status within lex-all of rhombus-prototype/shrubbery/lex.rkt and then run racket -l shrubbery/parse with your input, I see backups that are 1 instead of 0.
Thank you! My goal was to test I was using the non-zero backup correctly --- but it would probably also help if I actually get it correctly in the first place. So that's useful to to know, and I'll fix that problem instead/first.
When I log all the tokens from the lexer I do see this, too.
I should have started there -- simple case.
Instead I had tried to jump ahead to testing an update: I had been logging only the use of tokens to adjust the starting position. That's fine but the test needs to supply a position corresponding to such a non-zero backup token. I made a mistake with that, ergo saw nothing.