<commit_before>var ELEMENT = 'tag';
var ATTRIBUTE = 'attr';
var TEXT = 'text';
var COMMENT = 'comment';

function getContext(module, extContext){
  var BaseContext = module.at_base_context;

  if (!BaseContext)
  {
    var tmpl = module;
    var ATTRIBUTES_AND_CHILDREN = tmpl.ELEMENT_ATTRIBUTES_AND_CHILDREN || tmpl.ELEMENT_ATTRS;
    var typeMap = {};
    var walker;
    typeMap[tmpl.TYPE_ELEMENT] = ELEMENT;
    typeMap[tmpl.TYPE_ATTRIBUTE] = ATTRIBUTE;
    typeMap[tmpl.TYPE_ATTRIBUTE_CLASS] = ATTRIBUTE;
    typeMap[tmpl.TYPE_ATTRIBUTE_STYLE] = ATTRIBUTE;
    typeMap[tmpl.TYPE_ATTRIBUTE_EVENT] = ATTRIBUTE;
    typeMap[tmpl.TYPE_TEXT] = TEXT;
    typeMap[tmpl.TYPE_COMMENT] = COMMENT;

    if (typeof tmpl.declaration.walk === 'function')
      // try to use walker from basis.js
      walker = function(ast, handlers){
        tmpl.declaration.walk(ast, function(type, node, parent){
          var handler = handlers[this.tokenType(node)];

          if (typeof handler == 'function')
            handler.call(this, node, parent);
        }.bind(this));
      };
    else
      // own implementation of walker (old basis.js has no AST walker)
      walker = function(ast, handlers, parentToken, stIdx){
        for (var i = stIdx || 0, token; token = ast[i]; i++)
        {
          var tokenType = this.tokenType(token);
          var handler = handlers[tokenType];<commit_msg>fix build for old versions of basis.js<commit_after>var ELEMENT = 'tag';
var ATTRIBUTE = 'attr';
var TEXT = 'text';
var COMMENT = 'comment';

function getContext(module, extContext){
  var BaseContext = module.at_base_context;

  if (!BaseContext)
  {
    var tmpl = module;
    var ATTRIBUTES_AND_CHILDREN = tmpl.ELEMENT_ATTRIBUTES_AND_CHILDREN || tmpl.ELEMENT_ATTRS;
    var typeMap = {};
    var walker;
    typeMap[tmpl.TYPE_ELEMENT] = ELEMENT;
    typeMap[tmpl.TYPE_ATTRIBUTE] = ATTRIBUTE;
    typeMap[tmpl.TYPE_ATTRIBUTE_CLASS] = ATTRIBUTE;
    typeMap[tmpl.TYPE_ATTRIBUTE_STYLE] = ATTRIBUTE;
    typeMap[tmpl.TYPE_ATTRIBUTE_EVENT] = ATTRIBUTE;
    typeMap[tmpl.TYPE_TEXT] = TEXT;
    typeMap[tmpl.TYPE_COMMENT] = COMMENT;

    if (tmpl.declaration && typeof tmpl.declaration.walk === 'function')
      // try to use walker from basis.js
      walker = function(ast, handlers){
        tmpl.declaration.walk(ast, function(type, node, parent){
          var handler = handlers[this.tokenType(node)];

          if (typeof handler == 'function')
            handler.call(this, node, parent);
        }.bind(this));
      };
    else
      // own implementation of walker (old basis.js has no AST walker)
      walker = function(ast, handlers, parentToken, stIdx){
        for (var i = stIdx || 0, token; token = ast[i]; i++)
        {
          var tokenType = this.tokenType(token);
          var handler = handlers[tokenType];
{'fraction_non_alphanumeric': 0.1191912025540972, 'fraction_numerical': 0.000709471443774388, 'mean_word_length': 3.140969162995595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '870165', 'n_tokens_mistral': 961, 'n_tokens_neox': 944, 'n_words': 214}