npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nv-lex-tok-wchar

v1.0.6

Published

nv-lex-tok-wchar =============== - nv-lex-tok-wchar - to match keywords char-by-char ,used in char-stream-parser(for stage-0 using) - a simple version of nv-lex-kw(remove support-of-escape)

Readme

nv-lex-tok-wchar

  • nv-lex-tok-wchar
  • to match keywords char-by-char ,used in char-stream-parser(for stage-0 using)
  • a simple version of nv-lex-kw

install

  • npm install nv-lex-tok-wchar

usage

const {DFLT_CFG,STATES,ESC,parse_from_src} = require("nv-lex-tok-wchar")

example

from_str

    var chunk = `
    a"bcd" %%ef%% """gh"""i
    \\"ABC
    /*
    jk
    lm
    */  <!--rrrsssttt-->
    ##`

    const {DFLT_CFG,STATES,ESC,parse_from_src} = require("nv-lex-tok-wchar")

    /*
    > ESC
    '\\'
    >
    > DFLT_CFG
    [
      "'",    '"',    '`',   '·',    '“',
      '”',    '‘',    '’',   '%%',   '//',
      '/*',   '*/',   '{-',  '-}',   '(*',
      '*)',   '%(',   '%)',  '#|',   '|#',
      '#=',   '=#',   "'''", '"""',  '```',
      '···',  '“““',  '”””', '‘‘‘',  '’’’',
      '###',  '<!--', '-->', '<%--', '--%>',
      '--[[', '--]]'
    ]
    >
    */


    var r = parse_from_src(chunk,DFLT_CFG,ESC)

    > r.toks
    [
      '\n',
      'a',
      [ '"' ],
      'b',
      'c',
      'd',
      [ '"' ],
      ' ',
      [ '%', '%' ],
      'e',
      'f',
      [ '%', '%' ],
      ' ',
      [ '"', '"', '"' ],
      'g',
      'h',
      [ '"', '"', '"' ],
      'i',
      '\n',
      Esc { esc: '\\', raw: '"' },
      'A',
      'B',
      'C',
      '\n',
      [ '/', '*' ],
      '\n',
      'j',
      'k',
      '\n',
      'l',
      'm',
      '\n',
      [ '*', '/' ],
      ' ',
      ' ',
      [ '<', '!', '-', '-' ],
      'r',
      'r',
      'r',
      's',
      's',
      's',
      't',
      't',
      't',
      [ '-', '-', '>' ],
      '\n'
    ]

    >
    > r.lefted
    [ '#', '#' ]
    >

    > r.mach
    LongestMach {
      cfg_tree: Root [1 %ee357756:1% ] {},
      esc: '\\',
      curr: Wchar [79 %ee357756:79% ] { wchar: '#' },
      state: 1
    }

    > STATES
    {
      '0': 'init',
      '1': 'possible',
      '2': 'match',
      '3': 'esc',
      init: 0,
      possible: 1,
      match: 2,
      esc: 3
    }
    >

    > r.mach.curr.wlist_
    [ '#', '#' ]
    >
    > r.mach.lefted_
    [ '#', '#' ]
    >


    > r.mach.reset()

    /*
    > r.mach
    LongestMach {
      cfg_tree: Root [1 %ee357756:1% ] {},
      esc: '\\',
      curr: Root [1 %ee357756:1% ] {},
      state: 0
    }

    > r.mach.cfg_tree.show()
    《match》         【    '             】
    《possible》      【    ' '           】
    《longest match》 【    ' ' '         】
    《match》         【    "             】
    《possible》      【    " "           】
    《longest match》 【    " " "         】
    《match》         【    `             】
    《possible》      【    ` `           】
    《longest match》 【    ` ` `         】
    《match》         【    ·             】
    《possible》      【    · ·           】
    《longest match》 【    · · ·         】
    《match》         【    “             】
    《possible》      【    “ “           】
    《longest match》 【    “ “ “         】
    《match》         【    ”             】
    《possible》      【    ” ”           】
    《longest match》 【    ” ” ”         】
    《match》         【    ‘             】
    《possible》      【    ‘ ‘           】
    《longest match》 【    ‘ ‘ ‘         】
    《match》         【    ’             】
    《possible》      【    ’ ’           】
    《longest match》 【    ’ ’ ’         】
    《possible》      【    %             】
    《longest match》 【    % %           】
    《longest match》 【    % (           】
    《longest match》 【    % )           】
    《possible》      【    /             】
    《longest match》 【    / /           】
    《longest match》 【    / *           】
    《possible》      【    *             】
    《longest match》 【    * /           】
    《longest match》 【    * )           】
    《possible》      【    {             】
    《longest match》 【    { -           】
    《possible》      【    -             】
    《longest match》 【    - }           】
    《possible》      【    - -           】
    《longest match》 【    - - >         】
    《possible》      【    - - %         】
    《longest match》 【    - - % >       】
    《possible》      【    - - [         】
    《longest match》 【    - - [ [       】
    《possible》      【    - - ]         】
    《longest match》 【    - - ] ]       】
    《possible》      【    (             】
    《longest match》 【    ( *           】
    《possible》      【    #             】
    《longest match》 【    # |           】
    《longest match》 【    # =           】
    《possible》      【    # #           】
    《longest match》 【    # # #         】
    《possible》      【    |             】
    《longest match》 【    | #           】
    《possible》      【    =             】
    《longest match》 【    = #           】
    《possible》      【    <             】
    《possible》      【    < !           】
    《possible》      【    < ! -         】
    《longest match》 【    < ! - -       】
    《possible》      【    < %           】
    《possible》      【    < % -         】
    《longest match》 【    < % - -       】
    */

from toks

   const {parse}  = require("nv-lex-tok-wchar"); 

    var toks = ['Begin',' ','Object','    ','End',' ','Object']
    var cfg  = [
        ['Begin',' ', 'Object'],
        ['End',' ', 'Object']
    ]

    > parse(toks,cfg)
    {
      mach: LongestMach {
        cfg_tree: Root [1 %a81b0249:1% ] {},
        esc: '\\',
        curr: Root [1 %a81b0249:1% ] {},
        state: 0
      },
      toks: [ [ 'Begin', ' ', 'Object' ], '    ', [ 'End', ' ', 'Object' ] ],
      lefted: undefined
    }

METHODS

cfg-tree

     cfg_tree.add_chain
     cfg_tree.append_wchar
     cfg_tree.constructor
     cfg_tree.get_child
     cfg_tree.is_epsilon
     cfg_tree.is_wchar
     cfg_tree.match_branches_
     cfg_tree.show

mach

    mach.lefted_               mach.reset
    mach.input

    mach.cfg_tree              
    mach.curr                  
    mach.state
    mach.esc

APIS

    {
      DFLT_CFG: [
        "'",    '"',    '`',   '·',    '“',
        '”',    '‘',    '’',   '%%',   '//',
        '/*',   '*/',   '{-',  '-}',   '(*',
        '*)',   '%(',   '%)',  '#|',   '|#',
        '#=',   '=#',   "'''", '"""',  '```',
        '···',  '“““',  '”””', '‘‘‘',  '’’’',
        '###',  '<!--', '-->', '<%--', '--%>',
        '--[[', '--]]'
      ],
      creat_match_state_tree: [Function: creat_tree],
      _mach: {
        ESC: '\\',
        STATES: {
          '0': 'init',
          '1': 'possible',
          '2': 'match',
          '3': 'esc',
          init: 0,
          possible: 1,
          match: 2,
          esc: 3
        },
        _Mach: [class _Mach],
        LongestMach: [class LongestMach extends _Mach],
        FirstMach: [class FirstMach extends _Mach],
        _gen: [GeneratorFunction: _gen],
        gen_using_longest_match: [Function: gen_using_longest_match],
        gen_using_first_match: [Function: gen_using_first_match],
        is_esc: [Function: is_esc]
      },
      parse: [Function: parse],
      parse_from_src: [Function: parse_from_src],
      parse_from_file: [Function: parse_from_file],
      STATES: {
        '0': 'init',
        '1': 'possible',
        '2': 'match',
        '3': 'esc',
        init: 0,
        possible: 1,
        match: 2,
        esc: 3
      },
      ESC: '\\',
      is_esc: [Function: is_esc]
    }

LICENSE

  • ISC