import { type CommandSpec, type ValueType } from './types.ts'; /** * A CommandSpec lowered into the lookup tables the parser walks. * * Built once per spec (cached) instead of rebuilt on every parseCommand * call. Spellings are the dashed forms as typed (`-e`, `--regexp`); * `dest` maps every spelling to its canonical spelling, the long form * when an option declares both, so the parsed flag bag holds ONE entry * per option regardless of which spelling appeared on the line * (click/argparse dest semantics). Mirrors Python's CompiledSpec. */ export declare class CompiledSpec { /** Short spellings parsed as bare booleans (true booleans plus * optional-value shorts). */ readonly boolSpellings: ReadonlySet; /** Short spellings expecting a value, longest first so `-name` can * never lose an attached match to `-n`. */ readonly valueSpellings: readonly string[]; /** Short spellings whose value may attach to the same token * (`split -d10`), longest first. */ readonly attachSpellings: readonly string[]; /** Long spellings parsed as bare booleans (true booleans plus * optional-value longs). */ readonly longBoolSpellings: ReadonlySet; /** Long spellings that require a value. */ readonly longValueSpellings: ReadonlySet; /** Long spellings whose value only attaches via `=` (GNU optional * argument). */ readonly longOptionalSpellings: ReadonlySet; /** Every long spelling in declaration order (the order GNU's ambiguity * refusal lists possibilities), for getopt_long prefix expansion. */ readonly longSpellings: readonly string[]; /** Behavior signature per long spelling. Prefix candidates whose * signatures all match are one option in glibc's eyes (same action * struct), so the prefix resolves instead of refusing as ambiguous. */ readonly longSignatures: ReadonlyMap; /** Canonical spellings of int-typed options; the parser refuses a * non-integer value at parse time (argparse `type=int`). */ readonly intDests: ReadonlySet; /** Canonical spellings of float-typed options, refused the same way * (argparse `type=float`). */ readonly floatDests: ReadonlySet; /** Value kind per spelling (parse-time lookup). */ readonly kindOf: ReadonlyMap; /** Value kind per canonical spelling, for post-parse PATH/TEXT value * collection. */ readonly kindByDest: ReadonlyMap; /** Spelling -> canonical spelling. */ readonly dest: ReadonlyMap; /** Canonical spellings that accumulate repeated values into a list. */ readonly multipleDests: ReadonlySet; /** Canonical spellings that consume two tokens per occurrence and * accumulate both, flattened. */ readonly pairDests: ReadonlySet; /** Canonical spellings of boolean flags whose occurrences accumulate * into a number (click count, `-vvv`). */ readonly countDests: ReadonlySet; /** Allowed values per canonical spelling, in declaration order (the * order GNU's ARGMATCH refusal lists them). */ readonly choicesByDest: ReadonlyMap; /** Canonical spellings that must appear, in declaration order; a * default satisfies the requirement. */ readonly requiredDests: readonly string[]; /** Value recorded per canonical spelling when the flag is absent from * the line. */ readonly defaults: ReadonlyMap; readonly envByDest: ReadonlyMap; /** Canonical spelling fed by the `-` shorthand, when one * option declares it. */ readonly numericDest: string | null; /** Kind of the rest operand. */ readonly restKind: ValueType | null; readonly remainder: boolean; readonly baseDest: string | null; constructor(fields: { boolSpellings: ReadonlySet; valueSpellings: readonly string[]; attachSpellings: readonly string[]; longBoolSpellings: ReadonlySet; longValueSpellings: ReadonlySet; longOptionalSpellings: ReadonlySet; longSpellings: readonly string[]; longSignatures: ReadonlyMap; intDests: ReadonlySet; floatDests: ReadonlySet; kindOf: ReadonlyMap; kindByDest: ReadonlyMap; dest: ReadonlyMap; multipleDests: ReadonlySet; pairDests: ReadonlySet; countDests: ReadonlySet; choicesByDest: ReadonlyMap; requiredDests: readonly string[]; defaults: ReadonlyMap; envByDest: ReadonlyMap; numericDest: string | null; restKind: ValueType | null; baseDest: string | null; remainder: boolean; }); /** Canonical spelling for a typed spelling. */ destOf(spelling: string): string; } /** Lower a CommandSpec into parser lookup tables, cached per spec. */ export declare function compileSpec(spec: CommandSpec): CompiledSpec; /** * getopt_long prefix matching for a long spelling. * * An exact declared spelling always wins (GNU: `--binary` never trips * over `--binary-files`); otherwise the candidates are every declared * long the typed spelling prefixes. Candidates whose behavior signatures * all match count as one option, the way glibc treats several table * entries with one action struct (`grep --colo` resolves despite * `--color`/`--colour` being separate entries), and the prefix resolves * to the first. The result length tells the caller everything: 0 * unknown, 1 match, 2+ ambiguous (every matching spelling in * declaration order, the order GNU lists possibilities, synonyms * included like GNU's own listing). */ export declare function expandLong(cs: CompiledSpec, spelling: string): readonly string[]; //# sourceMappingURL=compile.d.ts.map