Parser expected tokens

I’ve been reading the rustc_parser code to get an idea of how it works. One thing that I cannot figure out, is how the accumulated expected tokens are cleared.

There’s a function on Parser called clear_tokens, but I can’t see it called anywhere.

Could someone please explain how, when, where accumulated expected tokens are cleared?

If you mean clear_expected_tokens, that is called in the format parser.

Tokens are normally removed in inlined_bump_with.

1 Like

Thanks Eric,

Can’t believe I missed that.