Combine regexes in arrays if possible

It is often useful to split up a big regex into separate logical
units. Unfortunately this is bad for performance, because the input
string has to be separately traversed for every unit.

This patch adds a simple optimization function, which walks through a
grammar and combines regexes that are split up in an array into one
single regex.

This can only be done, if the array contains only regexes, which all
have the same modifiers and no back references.
I used it, because the rest of the Prism code does it like that. `patterns` can be of the type Array, but the array object could still have a property named `splice`, which would overwrite the method `splice()` of the prototype. But maybe I misunderstood something here...