lexer.js
function regexes_for_category(lexer, category) {
  var REs = [];
  var done = false;
  for(var i = 0; !done && i < lexer.dialects.length; i++) {
    var dialect = lexer.dialects[i];
    if(dialect.lextab) {
      var categoryentry = dialect.lextab.find(function(lextabentry) {
         return lextabentry.category == category;
      });
      if(categoryentry) {
        REs.push(categoryentry.match);

        // if they've set entry.replace=true this dialect's
        // entry replaces other dialects' entries:
        done = categoryentry.replace;
      }
    }
  }
  return REs;
}
function regexes_for_category(lexer, category) {
  var REs = [];
  var done = false;
  for(var i = 0; !done && i < lexer.dialects.length; i++) {
    var dialect = lexer.dialects[i];
    if(dialect.lextab) {
      var categoryentry = dialect.lextab.find(function(lextabentry) {
         return lextabentry.category == category;
      });
      if(categoryentry) {
        REs.push(categoryentry.match);

        // if they've set entry.replace=true this dialect's
        // entry replaces other dialects' entries:
        done = categoryentry.replace;
      }
    }
  }
  return REs;
}
function regexes_for_category ( lexer , category ) { var REs = [ ] ; var done = false ; for ( var i = 0 ; ! done && i < lexer . dialects . length ; i ++ ) { var dialect = lexer . dialects [ i ] ; if ( dialect . lextab ) { var categoryentry = dialect . lextab . find ( function ( lextabentry ) { return lextabentry . category == category ; } ) ; if ( categoryentry ) { REs . push ( categoryentry . match ) ; // if they've set entry.replace=true this dialect's // entry replaces other dialects' entries: done = categoryentry . replace ; } } } return REs ; }
utility function accumulates all the regular expressions
for a given token category and returns them in an array
utility function accumulates all the regular expressions for a given token category and returns them in an array