hyperlark (TypeScript)
    Preparing search index...

    Class Lark

    A compiled grammar ready to parse. Reusable across parses. The PUBLIC surface; the generated _parse* methods are internal plumbing and are not part of this contract.

    Indexable

    • [key: number]: () => void
    Index
    • Construct from .lark grammar source (full bundle only).

      Parameters

      • grammar_source: string
      • Optionaloptions: LarkOptions | null

      Returns Lark

    • Returns void

    • Look up a compiled terminal by name (undefined when unknown).

      Parameters

      • name: string

      Returns TerminalDef | undefined

    • Lex text into Tokens without parsing. dont_ignore re-emits %ignore tokens.

      Parameters

      • text: string
      • Optionaldont_ignore: boolean | null

      Returns Token[]

    • Parse text into a Tree / Token / null, or — with opts.transformer (or a constructor-level transformer:) — the folded host value.

      Parameters

      • text: string
      • Optionalopts: ParseOptions & { transformer?: null }

      Returns Node

    • Parse text into a Tree / Token / null, or — with opts.transformer (or a constructor-level transformer:) — the folded host value.

      Type Parameters

      Parameters

      Returns FoldResult<T>

    • Parse text into a Tree / Token / null, or — with opts.transformer (or a constructor-level transformer:) — the folded host value.

      Parameters

      Returns unknown

    • Parse into a RETAINED-arena handle whose nodes are addressed by u32 positions — the selective-query escape from the eager full-tree copy-out.

      Parameters

      • text: string
      • Optionalstart: string | null

      Returns ParseHandle

    • Seat an interactive parser over text (lark parse_interactive): manual token-level control of the parse. Omit text to feed every token yourself via feedToken. LALR + built-in lexer only (Earley or a custom lexer throws).

      Parameters

      • Optionaltext: string | null
      • Optionalstart: string | null

      Returns InteractiveParser

    • Stream completed subtrees of the opts.on rule(s) to onSubtree as they reduce; returns the number of subtrees emitted. onSubtree returning false stops the parse cleanly.

      Parameters

      Returns number

    • Whether the instance was built with propagate_positions.

      Returns boolean

    • The resolved lexer name (auto already collapsed).

      Returns string

    • Tree data display names by id (introspection).

      Returns string[]

    • The declared start symbols.

      Returns string[]

    • Terminal type names by id (introspection).

      Returns string[]

    • Construct from a serialized tools.serialize grammar JSON string.

      Parameters

      • grammar_json: string
      • Optionaloptions: LarkOptions | null

      Returns Lark