function getAfter(from) {
          const parent = from.parent;
          if (parent.type === "Quantifier") {
            return getAfter(parent);
          } else if (parent.type === "Alternative") {
            const index = parent.elements.indexOf(from);
            const after = parent.elements[index + 1];
            if (after) {
              return after;
            } else {
              const grandParent = parent.parent;
              if (grandParent.type === "Pattern") {
                return null;
              } else {
                return getAfter(grandParent);
              }
            }
          } else {
            throw Error("Unreachable");
          }
        }
@param {Element} from
@returns {Element | null}