ret

  • Version 0.5.0
  • Published
  • 69.2 kB
  • No dependencies
  • MIT license

Install

npm i ret
yarn add ret
pnpm add ret

Overview

Tokenizes a string that represents a regular expression.

Index

Functions

function reconstruct

reconstruct: (token: Tokens) => string;

    function tokenizer

    tokenizer: (regexpStr: string) => Root;
    • Tokenizes a regular expression (that is currently a string)

      Parameter regexpStr

      String of regular expression to be tokenized

      Returns

      {Root}

    Interfaces

    interface SetLookup

    interface SetLookup {}
    • The number of elements in a set lookup, and a function that returns the lookup.

    property len

    len: number;

      property lookup

      lookup: () => Record<string | number, boolean>;

        Enums

        enum types

        enum types {
        ROOT = 0,
        GROUP = 1,
        POSITION = 2,
        SET = 3,
        RANGE = 4,
        REPETITION = 5,
        REFERENCE = 6,
        CHAR = 7,
        }

          member CHAR

          CHAR = 7

            member GROUP

            GROUP = 1

              member POSITION

              POSITION = 2

                member RANGE

                RANGE = 4

                  member REFERENCE

                  REFERENCE = 6

                    member REPETITION

                    REPETITION = 5

                      member ROOT

                      ROOT = 0

                        member SET

                        SET = 3

                          Type Aliases

                          type Char

                          type Char = ValueType<types.CHAR, number>;

                            type Group

                            type Group = Base<
                            types.GROUP,
                            {
                            stack?: Token[];
                            options?: Token[][];
                            remember: boolean;
                            followedBy?: boolean;
                            notFollowedBy?: boolean;
                            lookBehind?: boolean;
                            name?: string;
                            }
                            >;

                              type Position

                              type Position = ValueType<types.POSITION, '$' | '^' | 'b' | 'B'>;

                                type Range

                                type Range = Base<
                                types.RANGE,
                                {
                                from: number;
                                to: number;
                                }
                                >;

                                  type Reference

                                  type Reference = ValueType<types.REFERENCE, number>;

                                    type Repetition

                                    type Repetition = Base<
                                    types.REPETITION,
                                    {
                                    min: number;
                                    max: number;
                                    value: Token;
                                    }
                                    >;

                                      type Root

                                      type Root = Base<
                                      types.ROOT,
                                      {
                                      stack?: Token[];
                                      options?: Token[][];
                                      flags?: string[];
                                      }
                                      >;

                                        type Set

                                        type Set = Base<
                                        types.SET,
                                        {
                                        set: SetTokens;
                                        not: boolean;
                                        }
                                        >;

                                          type SetTokens

                                          type SetTokens = (Range | Char | Set)[];

                                            type Token

                                            type Token = Group | Position | Set | Range | Repetition | Reference | Char;

                                              type Tokens

                                              type Tokens = Root | Token;

                                                Package Files (6)

                                                Dependencies (0)

                                                No dependencies.

                                                Dev Dependencies (7)

                                                Peer Dependencies (0)

                                                No peer dependencies.

                                                Badge

                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ret.

                                                • Markdown
                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ret)
                                                • HTML
                                                  <a href="https://www.jsdocs.io/package/ret"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>