* Find the last string token and its index in parsed tokens
( tokens: ParseEntry[], )
| 53 | * Find the last string token and its index in parsed tokens |
| 54 | */ |
| 55 | function findLastStringToken( |
| 56 | tokens: ParseEntry[], |
| 57 | ): { token: string; index: number } | null { |
| 58 | const i = tokens.findLastIndex(t => typeof t === 'string') |
| 59 | return i !== -1 ? { token: tokens[i] as string, index: i } : null |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Check if we're in a context that expects a new command |