function isFirstMatch(element) {
  const parent = element.parent;
  switch (parent.type) {
    case 'Alternative':
      // all elements before this element have to of zero length
      if (!parent.elements.slice(0, parent.elements.indexOf(element)).every(isAlwaysZeroWidth)) {
        return false;
      }
      const grandParent = parent.parent;
      if (grandParent.type === 'Pattern') {
        return true;
      } else {
        return isFirstMatch(grandParent);
      }

    case 'Quantifier':
      if (parent.max >= 2) {
        return false;
      } else {
        return isFirstMatch(parent);
      }

    default:
      throw new Error(`Internal error: The given node should not be a '${element.type}'.`);
  }
}
Returns whether the given element will always at the start of the whole match.

@param {Element} element
@returns {boolean}