Yeah, but that does mean you're parsing pre and nowiki (and math, hiero, and possibly others) twice.
I wouldn't call it parsing them. It's just one line of php...
What would you tidy it to? At the moment, there is no unambiguous syntax for mixed apostrophes and bold/italics, other than <nowiki>.
Well, things like:
This '''bold text stops [[page|halfway through''' a link]].
Would become:
This '''bold text stops '''[[page|'''halfway through''' a link]].
More complicated things might be a little harder, but pretty much anything is possible to describe unambiguously in wikisyntax, so once we determine what each weird sequence should mean, it can be rewritten more clearly (for example, don't allow any nesting at all, and treat bold italic as a separate 3rd format).
Nope, other than it doesn't require processing the text again, and is more akin to the model of context-free grammar we're theoretically aspiring to. It seems cleaner to me to clearly define the exception to the EBNF this way, but that could be a bias not based on much real evidence.
I think the amount is processing is the same either way. With my way, we do end up with a pure EBNF parser, just with something tacked on the beginning. With your way, the EBNF part and the exception is all mixed together.
Any third opinions?