Function findLeafNodeBeforeOffset

  • Finds the leaf CST node at the specified 0-based string offset. If no CST node exists at the specified position, it will return the leaf node before it.

    If there is no leaf node before the specified offset, this method will return undefined.

    Parameters

    • node: CstNode

      The CST node to search through.

    • offset: number

      The specified offset.

    Returns LeafCstNode | undefined

    The CST node closest to the specified offset.