When the -else- clause is removed, then the program crashes only when
the second token is set to an asterisk, suggesting that it is the
comments in there that are somehow confusing things?
I'm not totally clear about this, but I think that Stata expects a loaded
program to have no commented-out text. That is, any commented-out text it
finds at load time is stripped out; once loaded, a program has no
comments. (Do -program list-; you will see: no more comments.) But now
you are introducing a new twist: parts of the program become commented-out
at run time. Perhaps the comment-skipping feature does not operate (at
least, not completely) while running a program, as it is presumed to have
already gone through that step at load time.