import type { Combinator } from '../types.ts'; export type KeywordsOptions = { /** Match case-insensitively. */ caseInsensitive?: boolean; /** * Character class (regex source, e.g. `'A-Za-z0-9_-'`) that must NOT follow a * match — a word boundary. Prevents matching `red` inside `redish`. */ boundary?: string; }; export type WordOptions = Omit; /** * Match a single keyword with an automatic word-boundary guard. Prevents * matching `true` inside `trueish`. The boundary defaults to `_0-9A-Za-z`, * which covers most programming-language identifiers. * * word('true') // matches "true" but not "trueish" * word('color', 'A-Za-z-') // CSS-style identifier boundary * word('media', 'A-Za-z0-9_-', { caseInsensitive: true }) * word('media', { caseInsensitive: true }) // default boundary + options * * `caseInsensitive` matches `keywords()` and exists because it is REQUIRED, not a * nicety: CSS at-keywords, function names and units are ASCII case-insensitive per * spec (CSS Syntax §3). Without it the only conforming spellings were * `regex(/media/i)` — which `analyzeGating` correctly flags as the `keyword-regex` * anti-pattern — or `keywords(['media'], …)` for a single word. */ export declare function word(str: string, boundary?: string, opts?: WordOptions): Combinator; export declare function word(str: string, opts: WordOptions): Combinator; /** * Create a keyword factory with a fixed word-boundary class. Use when many * keywords share the same boundary (e.g. CSS identifiers). For a single keyword, * `word(str, boundary?)` is enough. * * const kw = makeWord() // default boundary * const cssKw = makeWord('A-Za-z0-9_-', { caseInsensitive: true }) * * const query = kw('query') * const color = cssKw('color') // matches "COLOR" but not "color-scheme" */ export declare function makeWord(boundary?: string, opts?: WordOptions): (str: string) => Combinator; export declare function makeWord(opts: WordOptions): (str: string) => Combinator; /** The terminal's one canonical recognizer spelling. Table-selected lexical * bodies call this at construction time so the authored parser, CHARACTER row, * and TOKEN replacement cannot drift on alternation order, boundary, or flags. */ export declare function keywordsRegExp(words: readonly string[], boundary: string | undefined, caseInsensitive: boolean): RegExp; /** * Match any one of a set of fixed keywords, longest-first (so `border` wins over * `bord`), with an optional trailing word-boundary guard. Compiles to a single * sticky regex — far less error-prone than a hand-maintained alternation, and * the common case (keyword sets: CSS colors, units, at-rule names, HTML tags). * * keywords(CSS_COLOR_NAMES, { caseInsensitive: true, boundary: 'A-Za-z0-9_-' }) * * On success the matched text is recorded as a CSTLeaf (like literal()/regex()). */ export declare function keywords(words: readonly string[], opts?: KeywordsOptions): Combinator; //# sourceMappingURL=keywords.d.ts.map