includeRequiredTag(i, highlightLoc, tag) {
    const isCloseTag = tag.startsWith('</');
    const tagName = isCloseTag ? tag.split('</')[1].split('>')[0] : tag.split(' ')[0].split('<')[1].split('>')[0];
    let included = false;
    let requiredTagNumber = 1;
    let requiredTagCount = 0; // if both the start tag and the end tag are at the borders, place the tags outside the borders
    // if the close tag is at the border, check backwards until the start of the highlight

    if (isCloseTag) {
      for (let i2 = i - 1; i2 >= 0; i2--) {
        const tagLoc2 = this.tagLocations[i2];

        if (highlightLoc[0] > tagLoc2[0]) {
          break;
        } else {
          const tag2 = this.originalContent.substring(tagLoc2[0] + tagLoc2[2], tagLoc2[0] + tagLoc2[2] + tagLoc2[1]);

          if (tag2.startsWith('</' + tagName)) {
            requiredTagNumber++;
          } else if (tag2.startsWith('<' + tagName)) {
            requiredTagCount++;
          }

          if (requiredTagNumber === requiredTagCount) {
            included = true;
            break;
          }
        }
      }
    } // if the start tag is at the border, check forwards until the end of the highlight
    else {
        for (let i2 = i + 1; i2 < this.tagLocations.length; i2++) {
          const tagLoc2 = this.tagLocations[i2];

          if (highlightLoc[1] < tagLoc2[0]) {
            break;
          } else {
            const tag2 = this.originalContent.substring(tagLoc2[0] + tagLoc2[2], tagLoc2[0] + tagLoc2[2] + tagLoc2[1]);

            if (tag2.startsWith('<' + tagName)) {
              requiredTagNumber++;
            } else if (tag2.startsWith('</' + tagName)) {
              requiredTagCount++;
            }

            if (requiredTagNumber === requiredTagCount) {
              included = true;
              break;
            }
          }
        }
      }

    return included;
  }
// includeRequiredTag used in = condition only
includeRequiredTag used in = condition only
includeRequiredTag used in = condition only
includeRequiredTag(i, highlightLoc, tag) {
    const isCloseTag = tag.startsWith('</');
    const tagName = isCloseTag ? tag.split('</')[1].split('>')[0] : tag.split(' ')[0].split('<')[1].split('>')[0];
    let included = false;
    let requiredTagNumber = 1;
    let requiredTagCount = 0; 
    if (isCloseTag) {
      for (let i2 = i - 1; i2 >= 0; i2--) {
        const tagLoc2 = this.tagLocations[i2];
        if (highlightLoc[0] > tagLoc2[0]) {
          break;
        } else {
          const tag2 = this.originalContent.substring(tagLoc2[0] + tagLoc2[2], tagLoc2[0] + tagLoc2[2] + tagLoc2[1]);
          if (tag2.startsWith('</' + tagName)) {
            requiredTagNumber++;
          } else if (tag2.startsWith('<' + tagName)) {
            requiredTagCount++;
          }
          if (requiredTagNumber === requiredTagCount) {
            included = true;
            break;
          }
        }
      }
    } 
    else {
        for (let i2 = i + 1; i2 < this.tagLocations.length; i2++) {
          const tagLoc2 = this.tagLocations[i2];
          if (highlightLoc[1] < tagLoc2[0]) {
            break;
          } else {
            const tag2 = this.originalContent.substring(tagLoc2[0] + tagLoc2[2], tagLoc2[0] + tagLoc2[2] + tagLoc2[1]);
            if (tag2.startsWith('<' + tagName)) {
              requiredTagNumber++;
            } else if (tag2.startsWith('</' + tagName)) {
              requiredTagCount++;
            }
            if (requiredTagNumber === requiredTagCount) {
              included = true;
              break;
            }
          }
        }
      }
    return included;
  }
includeRequiredTag ( i , highlightLoc , tag ) { const isCloseTag = tag . startsWith ( '</' ) ; const tagName = isCloseTag ? tag . split ( '</' ) [ 1 ] . split ( '>' ) [ 0 ] : tag . split ( ' ' ) [ 0 ] . split ( '<' ) [ 1 ] . split ( '>' ) [ 0 ] ; let included = false ; let requiredTagNumber = 1 ; let requiredTagCount = 0 ; if ( isCloseTag ) { for ( let i2 = i - 1 ; i2 >= 0 ; i2 -- ) { const tagLoc2 = this . tagLocations [ i2 ] ; if ( highlightLoc [ 0 ] > tagLoc2 [ 0 ] ) { break ; } else { const tag2 = this . originalContent . substring ( tagLoc2 [ 0 ] + tagLoc2 [ 2 ] , tagLoc2 [ 0 ] + tagLoc2 [ 2 ] + tagLoc2 [ 1 ] ) ; if ( tag2 . startsWith ( '</' + tagName ) ) { requiredTagNumber ++ ; } else if ( tag2 . startsWith ( '<' + tagName ) ) { requiredTagCount ++ ; } if ( requiredTagNumber === requiredTagCount ) { included = true ; break ; } } } } else { for ( let i2 = i + 1 ; i2 < this . tagLocations . length ; i2 ++ ) { const tagLoc2 = this . tagLocations [ i2 ] ; if ( highlightLoc [ 1 ] < tagLoc2 [ 0 ] ) { break ; } else { const tag2 = this . originalContent . substring ( tagLoc2 [ 0 ] + tagLoc2 [ 2 ] , tagLoc2 [ 0 ] + tagLoc2 [ 2 ] + tagLoc2 [ 1 ] ) ; if ( tag2 . startsWith ( '<' + tagName ) ) { requiredTagNumber ++ ; } else if ( tag2 . startsWith ( '</' + tagName ) ) { requiredTagCount ++ ; } if ( requiredTagNumber === requiredTagCount ) { included = true ; break ; } } } } return included ; }
includeRequiredTag used in = condition only
includeRequiredTag used in = condition only
// if both the start tag and the end tag are at the borders, place the tags outside the borders // if the close tag is at the border, check backwards until the start of the highlight // if the start tag is at the border, check forwards until the end of the highlight