function getTokenAtPosition(sourceFile, position, allowPositionInLeadingTrivia, includeEndPosition) {
    let current = sourceFile;
    outer: while (true) {
        // find the child that contains 'position'
        for (const child of current.getChildren()) {
            const start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, /*includeJsDoc*/ true);
            if (start > position) {
                // If this child begins after position, then all subsequent children will as well.
                break;
            }
            const end = child.getEnd();
            if (position < end || (position === end && (child.kind === ts.SyntaxKind.EndOfFileToken || includeEndPosition))) {
                current = child;
                continue outer;
            }
        }
        return current;
    }
}
function getTokenAtPosition(sourceFile, position, allowPositionInLeadingTrivia, includeEndPosition) {
    let current = sourceFile;
    outer: while (true) {
        // find the child that contains 'position'
        for (const child of current.getChildren()) {
            const start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, /*includeJsDoc*/ true);
            if (start > position) {
                // If this child begins after position, then all subsequent children will as well.
                break;
            }
            const end = child.getEnd();
            if (position < end || (position === end && (child.kind === ts.SyntaxKind.EndOfFileToken || includeEndPosition))) {
                current = child;
                continue outer;
            }
        }
        return current;
    }
}
function getTokenAtPosition ( sourceFile , position , allowPositionInLeadingTrivia , includeEndPosition ) { let current = sourceFile ; outer : while ( true ) { // find the child that contains 'position' for ( const child of current . getChildren ( ) ) { const start = allowPositionInLeadingTrivia ? child . getFullStart ( ) : child . getStart ( sourceFile , /*includeJsDoc*/ true ) ; if ( start > position ) { // If this child begins after position, then all subsequent children will as well. break ; } const end = child . getEnd ( ) ; if ( position < end || ( position === end && ( child . kind === ts . SyntaxKind . EndOfFileToken || includeEndPosition ) ) ) { current = child ; continue outer ; } } return current ; } }
Get the token whose text contains the position
Get the token whose text contains the position
Get the token at the given position