Finds the leftmost token satisfying `position < token.End()`. If the leftmost token satisfying `position < token.End()` is invalid, or if position is in the trivia of that leftmost token, we will find the rightmost valid token with `token.End() <= position`.
(sourceFile *ast.SourceFile, position int)
| 326 | // is in the trivia of that leftmost token, |
| 327 | // we will find the rightmost valid token with `token.End() <= position`. |
| 328 | func FindPrecedingToken(sourceFile *ast.SourceFile, position int) *ast.Node { |
| 329 | return FindPrecedingTokenEx(sourceFile, position, nil, false) |
| 330 | } |
| 331 | |
| 332 | func FindPrecedingTokenEx(sourceFile *ast.SourceFile, position int, startNode *ast.Node, excludeJSDoc bool) *ast.Node { |
| 333 | var find func(node *ast.Node) *ast.Node |