Performance improvements, <code> tag fixes

Add a regular expresson optimization pattern to allow merging of
Sequence, Choice, or Repetitions

Also specify __slots__ for commonly instantiated patterns.