Porting invRegex.py to Javascript (Node.js)

后端 未结 6 1906
余生分开走
余生分开走 2020-12-16 03:16

I have been trying to port invRegex.py to a node.js implementation for a while, but I\'m still struggling with it. I already have the regular expression parse tree thanks to

6条回答
  •  盖世英雄少女心
    2020-12-16 04:17

    How about this:

    var tokens = [
        ['0', '00', '01', '1', '10', '11'],
        ['@'],
        ['a', 'b', 'c', 'd', 'e', 'f'],
    ];
    
    function cartesianProductOf(arr, callback) {
      var cur = [];
      var f = function(i) {
        if (i >= arr.length) {
          callback(cur.join(''));
          return
        }
        for (var j=0; j

提交回复
热议问题