# Color lexer backup distances and \`dont-stop\`

**URL:** <https://racket.discourse.group/t/color-lexer-backup-distances-and-dont-stop/2170>\
**Category:** Questions & Answers\
**Tags:** question\
**Created:** [July 28, 2023, 5:02pm UTC](https://racket.discourse.group/t/color-lexer-backup-distances-and-dont-stop/2170 "2023-07-28T17:02:50Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [August 9, 2023, 12:09am UTC](https://racket.discourse.group/t/color-lexer-backup-distances-and-dont-stop/2170/6 "2023-08-09T00:09:11Z")

</div>

> [@mflatt](#):
>
> I think the history is that the need for backup was noticed before the need for something like `dont-stop`. When `dont-stop` was added later, it wasn't immediately obvious that the two always need to go together. As far as I can tell now, they need to be used in tandem.

I'm persuaded that needing a backup distance always implies needing `dont-stop`, but I thought the following was an example of needing `dont-stop` _not_ necessarily implying the need for a non-zero backup distance (I could be wrong, though!):

> [@LiberalArtist](#):
>
> If you only need to peek into the next token, as with `[a-]` vs. `[a-z]`, IIUC you need `dont-stop` but don't need a backup distance.

(I'm assuming that in `[a-]` you want to color `-` as a literal character, but in `[a-z]` you want to color it as an infix operator.)

In the course of looking into this, I had also come across @greghendershott's call for an example of `dont-stop` in use:

> [@Example of a lang lexer that returns a \`dont-stop\` struct?](https://racket.discourse.group/t/example-of-a-lang-lexer-that-returns-a-dont-stop-struct/438):
>
> A lang's [module lexer can return a dont-stop struct](https://docs.racket-lang.org/syntax-color/index.html#%28def._%28%28lib._syntax-color%2Flexer-contract..rkt%29._dont-stop%29%29). I would like to test my handling of that. But so far (with e.g. langs racket, rhombus, and scribble/manual) I'm never seeing a dont-stop. What's an example of such a #lang? What's some minimal example program in that #lang eliciting the dont-stop value?

Since no one came up with an example, it might be that there's more ability to make changes without causing problems in practice than I would otherwise assume.

---

_[View the full topic](https://racket.discourse.group/t/color-lexer-backup-distances-and-dont-stop/2170)._
