Skip to content

stagas/lexer-next

Repository files navigation

lexer-next

lexer for recursive descent parsers

npm i lexer-next pnpm add lexer-next yarn add lexer-next

API

# createLexer(tokenize) src/index.ts#L106

    # tokenize

    createLexer(tokenize)  =>

      # (input)

        # input

          string

        (input)  =>

# LexerErrorCauses src/causes.ts#L1
# LexerError src/index.ts#L15

    # constructor(cause) src/index.ts#L21
    # cause src/index.ts#L16
    # name  =  'LexerError' src/index.ts#L20

      string

    # prepareStackTrace

      # (err, stackTraces)

        # err

          Error

        # stackTraces

          CallSite []

        (err, stackTraces)  =>

          any

    # stackTraceLimit

      number

    # captureStackTrace(targetObject, constructorOpt)

      # targetObject

        object

      # constructorOpt

        Function

      captureStackTrace(targetObject, constructorOpt)  =>

        void

# RegExpToken

    # constructor(pattern)

# Token
# Lexer src/index.ts#L46
# RegExpMatchArrayLike

    # index

      number

    # input

      string

# TokenJson

    # group

      string

    # source

      {

      # index

        number

      # input

        string

      # match

        string []

      }

    # value

      string

# ErrorHandler src/index.ts#L31
# FilterFunction src/index.ts#L39

    # (token)

      # token

      (token)  =>

        boolean

# LexerFactory src/index.ts#L95

    # (input)

      # input

        string

      (input)  =>

# Tokenizer src/index.ts#L41

    # (input)

      # input

        string

      (input)  =>

        IterableIterator<RegExpMatchArray>

# createLexer(tokenize) src/index.ts#L106

    # tokenize

    createLexer(tokenize)  =>

      # (input)

        # input

          string

        (input)  =>

Credits

Contributing

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2022 stagas