Skip to content

stagas/tinypratt

Repository files navigation

tinypratt

a tiny pratt parser implementation

npm i tinypratt pnpm add tinypratt yarn add tinypratt

API

# ParserErrorCauses src/causes.ts#L1
# LexerError

    # constructor(cause)
    # cause

      UnexpectedToken

    # name

      string

    # prepareStackTrace

      # (err, stackTraces)

        # err

          Error

        # stackTraces

          CallSite []

        (err, stackTraces)  =>

          any

    # stackTraceLimit

      number

    # captureStackTrace(targetObject, constructorOpt)

      # targetObject

        object

      # constructorOpt

        Function

      captureStackTrace(targetObject, constructorOpt)  =>

        void

# ParserError src/index.ts#L58
# Token

    # constructor(value)
    # group

      string

    # source

      RegExpMatchArrayLike

    # index
    # value
    # as(value, group)

      # value

        string

      # group

        string

      as(value, group)  =>

    # is(group, value)

      # group

        string

      # value

        string

      is(group, value)  =>

        boolean

    # toJSON()
    # create(value, group, source)

      # value

        string

      # group

        string

      # source

        RegExpMatchArrayLike

      create(value, group, source)  =>

# Impl src/index.ts#L28
# NodeArray src/index.ts#L12
# TokenJson

    # group

      string

    # source

      {

      # index

        number

      # input

        string

      # match

        string []

      }

    # value

      string

# Node src/index.ts#L16
# createParser(regexp, fn) src/index.ts#L72

    # regexp

      RegExp

    # fn

      ImplTableFactory

    createParser(regexp, fn)  =>

      # (input)

        # input

          string

        (input)  =>

# joinRegExp(regexps, flags)

    # regexps

      RegExp | RegExp [] []

    # flags

      string

    joinRegExp(regexps, flags)  =>

      RegExp

Credits

Contributing

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2022 stagas