[I6] Precedence of InScope() note on DM4 p. 235?

On DM4 p. 235, there’s a note that reads: “The token scope= takes precedence over InScope, which will only be reached if the routine returns false to signify ‘carry on’.”

I’ve been trying to decode this passage for a while, but I can’t make sense of it. Which routine is meant by the phrase “if the routine returns false”?

If I assume that it means the routine in scope=Routine, then (based on what’s described in the section) Routine only returns a value in three scenarios:

  • (scope_stage == 1), in which case returning false means “only a single object can result from this token”
  • (scope_stage == 2), in which case returning false means “don’t exclude objects normally in scope”
  • (scope_stage == 3), which is only called in case the token fails, to let the token print an error message, and in which case it doesn’t seem to matter whether true or false is returned

Likewise, the section (also p. 235, just above) says that a provided InScope() routine should act as though it were a scope=Routine token responding to scope_stage 2. It makes sense that returning false from this would pass the baton from InScope() to any scope=Routine tokens in various grammar lines, because a) presumably InScope() is executed prior to any grammar lines, and b) presumably returning false is all that the default stub version of InScope() does. But if I assume that “the routine return[ing] false” is InScope(), then I don’t think it makes sense to say that any scope=Routine tokens would only be reached if InScope() returns false – wouldn’t the parser still be looking at grammar lines even if InScope returns true?

Have you looked at the SearchScope() routine in parserm.h? That’s what it’s describing.

@zarf, No, but I will now. Thank you for the pointer.