Also, as noted elsewhere, wikitext is basically the set of all strings, since we don't want to generate "compilation errors".
Are we sure we don't? Making certain sequences simply invalid would solve quite a few problems. It would also be in keeping with the principle of least surprise - if we can't be sure what the user is trying to do, it's best to ask rather than guess and get it wrong.