Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "xform/print"

Index

Functions

Functions

Const print

  • Syntax sugar for xform(parser, xfPrint).

    example
    print(seq([lit("["), oneOrMore(ALPHA), lit("]")]))(defContext("[abc]"))
    // seq: null
    //   lit: "["
    //   repeat1: null
    //     lit: "a"
    //     lit: "b"
    //     lit: "c"
    //   lit: "]"

    Type parameters

    • T

    Parameters

    • parser: Parser<T>
    • Optional fn: Fn<string, void>

    Returns Fn<ParseContext<T>, boolean>

Const xfPrint

  • Side effect only. Higher order scope transform. Traverses current AST node and all children and prints each node's ID, result and reader state (if available). Also see print.

    remarks

    The optional fn function is used to print each AST node (default: console.log).

    Parameters

    • Default value fn: Fn<string, void> = console.log

    Returns ScopeTransform<any>

Generated using TypeDoc