(argv: ReadonlyArray<string>)
| 23 | |
| 24 | /** @internal */ |
| 25 | export function lex(argv: ReadonlyArray<string>): LexResult { |
| 26 | const endIndex = argv.indexOf("--") |
| 27 | |
| 28 | if (endIndex === -1) { |
| 29 | // No -- delimiter, lex everything normally |
| 30 | return { |
| 31 | tokens: lexTokens(argv), |
| 32 | trailingOperands: [] |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // Split at -- delimiter |
| 37 | return { |
| 38 | tokens: lexTokens(argv.slice(0, endIndex)), |
| 39 | trailingOperands: argv.slice(endIndex + 1) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | const lexTokens = (args: ReadonlyArray<string>): ReadonlyArray<Token> => { |
| 44 | const tokens: Array<Token> = [] |
nothing calls this directly
no test coverage detected