MCPcopy Create free account
hub / github.com/Effect-TS/effect / lex

Function lex

packages/effect/src/unstable/cli/internal/lexer.ts:25–41  ·  view source on GitHub ↗
(argv: ReadonlyArray<string>)

Source from the content-addressed store, hash-verified

23
24/** @internal */
25export 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
43const lexTokens = (args: ReadonlyArray<string>): ReadonlyArray<Token> => {
44 const tokens: Array<Token> = []

Callers

nothing calls this directly

Calls 1

lexTokensFunction · 0.85

Tested by

no test coverage detected