docs: function process(tokens, template, options){
  
      var result = [];
  
      for (var i = 0, token, item; token = tokens[i]; i++)
      {
        var refs = refList(token);
        var bindings = bindingList(token);
  
        switch (token.type)
        {
          case TYPE_ELEMENT:
            // special elements (basis namespace)
            if (token.prefix == 'b')
            {
              /** @cut */ if (topLevelInstructions.indexOf(token.name) === -1)
              /** @cut */   options.allowTopInstruction = false;
              /** @cut */ else if (!options.allowTopInstruction)
              /** @cut */   utils.addTemplateWarn(template, options, 'Instruction tag <b:' + token.name + '> should be placed in the beginning of template before any markup or instructions other than ' + humanTopLevelInstrcutionList + '. Currently it may works but will be ignored in future.', token.loc);
  
              if (!elementHandlers.hasOwnProperty(token.name))
              {
                /** @cut */ utils.addTemplateWarn(template, options, 'Unknown instruction tag: <b:' + token.name + '>', token.loc);
                continue;
              }
  
              elementHandlers[token.name](template, options, token, result);
  
              // don't add to declaration
              continue;
            }
  
            /** @cut */ options.allowTopInstruction = false;
  
            // <b:template>/<b:import> part
            // var name = getTokenName(token);
            // if (hasOwnProperty.call(options.templates, name))
            // {
            //   var decl = options.templates[name];
            //   var declTokens = cloneDecl(decl.tokens);
            //   var tokenRefMap = normalizeRefs(declTokens);
  
            //   template.includes.push({
            //     token: token,
            //     resource: null, // TODO
            //     nested: decl.includes
            //   });
  
            //   if (decl.deps)
            //     addUnique(template.deps, decl.deps);
  
            //   if (decl.resources)
            //     addUnique(template.resources, decl.resources);
  
            //   if (decl.warns)
            //     template.warns.push.apply(template.warns, decl.warns);
  
            //   /** @cut */ if (decl.removals)
            //   /** @cut */   template.removals.push.apply(template.removals, decl.removals);
  
            //   // FIXME
            //   // var styleNSIsolate = {
            //   //   /** @cut */ map: options.styleNSIsolateMap,
            //   //   prefix: genIsolateMarker()
            //   // };
  
            //   // for (var key in decl.styleNSPrefix)
            //   //   template.styleNSPrefix[styleNSIsolate.prefix + key] = basis.object.merge(decl.styleNSPrefix[key], {
            //   //     /** @cut */ used: hasOwnProperty.call(options.styleNSIsolateMap, styleNSIsolate.prefix + key)
            //   //   });
  
            //   if (tokenRefMap.element)
            //     removeTokenRef(tokenRefMap.element.node, 'element');
  
            //   result.push.apply(result, declTokens);
            //   continue;
            // }
  
            item = [
              1,                       // TOKEN_TYPE = 0
              bindings,                // TOKEN_BINDINGS = 1
              refs,                    // TOKEN_REFS = 2
              getTokenName(token)      // ELEMENT_NAME = 3
            ];
  
            applyAttrs(template, options, item, token.attrs);
            item.push.apply(item, process(token.children, template, options));
  
            break;
  
          case TYPE_TEXT:
            if (refs && refs.length == 2 && arraySearch(refs, 'element'))
              bindings = refs[+!refs.lastSearchIndex]; // get first one reference but not `element`
  
            item = [
              3,                       // TOKEN_TYPE = 0
              bindings,                // TOKEN_BINDINGS = 1
              refs                     // TOKEN_REFS = 2
            ];
  
            // TEXT_VALUE = 3
            if (!refs || token.value != '{' + refs.join('|') + '}')
              item.push(token.value);
  
            break;
  
          case TYPE_COMMENT:
            if (options.optimizeSize && !bindings && !refs)
              continue;
  
            item = [
              8,                       // TOKEN_TYPE = 0
              bindings,                // TOKEN_BINDINGS = 1
              refs                     // TOKEN_REFS = 2
            ];
  
            // COMMENT_VALUE = 3
            if (!options.optimizeSize)
              if (!refs || token.value != '{' + refs.join('|') + '}')
                item.push(token.value);
  
            break;
  
          default:
            /** @cut */ utils.addTemplateWarn(template, options, 'Unknown token type: ' + token.type, token);
            continue;
        }
  
        /** @cut */ options.allowTopInstruction = false;
        /** @cut */ utils.addTokenLocation(template, options, item, token);
        /** @cut */ item.sourceToken = token;
  
        result.push(item);
      }
  
  
      return result;
    }