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.
The easiest way to understand it, is probably to step through the example with a js debugger...