tslex
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

demo

import { LexerRule } from './automaton.js';
import { genDFA } from './main.js';

let rules = [
  {
    reg: '"([^"]|(\\\\"))*"',
    handler: function (text) {
      console.log(`规则①成功解析到${text}`);
    },
  },
] as LexerRule[];
let dfa = genDFA(rules);
dfa.setSource('"abc\\""');
dfa.run();

输出

规则①成功解析到"abc\""

/tslex/

    Package Sidebar

    Install

    npm i tslex

    Weekly Downloads

    141

    Version

    1.0.4

    License

    ISC

    Unpacked Size

    174 kB

    Total Files

    34

    Last publish

    Collaborators

    • yangzhenzhuozz