Fix quantifier and non-capturing group interaction under JavaScript

Multiple quantifiers for the same token are not allowed in
JavaScript. However, our check was too broad for this before and it
was throwing an error when a non-capturing group ended in a repeat and
there was a repeat immediately following the non-capturing group.

This fixes that behavior by respecting the boolean group flag to know
whether we're dealing with a non-capturing group or not.